diff --git a/infra/functionapp.tf b/infra/functionapp.tf index d2fc295..9f72d68 100644 --- a/infra/functionapp.tf +++ b/infra/functionapp.tf @@ -22,6 +22,11 @@ variable "FA_JWT_SECRET" { sensitive = true } +variable "DB_ADMIN_USER" { + type = string + sensitive = true +} + resource "azurerm_service_plan" "sp" { name = "pontozo-sp-tf" resource_group_name = azurerm_resource_group.tf-rg.name @@ -61,6 +66,8 @@ resource "azurerm_windows_function_app" "function-app" { "CLIENT_SECRET" = var.MTFSZ_CLIENT_SECRET "DB_NAME" = azurerm_mssql_database.sqldatabase.name "DB_PWD" = var.DB_PWD + "DB_ADMIN_PWD" = var.DB_ADMIN_PWD + "DB_ADMIN_USER" = var.DB_ADMIN_USER "DB_SERVER" = azurerm_mssql_server.sqlserver.fully_qualified_domain_name "DB_USER" = var.DB_USER "ENCRYPT" = true diff --git a/packages/functions/host.json b/packages/functions/host.json index 4750a79..ec9d4e7 100644 --- a/packages/functions/host.json +++ b/packages/functions/host.json @@ -2,7 +2,8 @@ "version": "2.0", "logging": { "logLevel": { - "default": "Information" + "default": "Information", + "Host.Triggers.DurableTask": "Warning" } }, "extensionBundle": { diff --git a/packages/functions/src/functions/seed.ts b/packages/functions/src/functions/seed.ts index 35cb996..341451d 100644 --- a/packages/functions/src/functions/seed.ts +++ b/packages/functions/src/functions/seed.ts @@ -6,7 +6,7 @@ import Category from '../typeorm/entities/Category' import Criterion from '../typeorm/entities/Criterion' import Season from '../typeorm/entities/Season' import UserRoleAssignment from '../typeorm/entities/UserRoleAssignment' -import { getAppDataSource } from '../typeorm/getConfig' +import { getAdminDataSource } from '../typeorm/getConfig' import { ADMINS } from '../util/env' import { handleException } from '../util/handleException' @@ -413,7 +413,7 @@ export const seed = async (req: HttpRequest, context: InvocationContext): Promis try { const user = await getUserFromHeaderAndAssertAdmin(req, context) - const [ads, redisClient] = await Promise.all([getAppDataSource(context), getRedisClient(context)]) + const [ads, redisClient] = await Promise.all([getAdminDataSource(), getRedisClient(context)]) const seasonRepo = ads.getRepository(Season) const categoryRepo = ads.getRepository(Category) const criterionRepo = ads.getRepository(Criterion)