Skip to content

Commit

Permalink
reduce durable functions logging and add dbadmin cred
Browse files Browse the repository at this point in the history
  • Loading branch information
Tschonti committed May 6, 2024
1 parent 2efa680 commit 33cfba6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 7 additions & 0 deletions infra/functionapp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion packages/functions/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"version": "2.0",
"logging": {
"logLevel": {
"default": "Information"
"default": "Information",
"Host.Triggers.DurableTask": "Warning"
}
},
"extensionBundle": {
Expand Down
4 changes: 2 additions & 2 deletions packages/functions/src/functions/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 33cfba6

Please sign in to comment.