Skip to content

Commit 66b732f

Browse files
committed
refactored
1 parent 2697d98 commit 66b732f

21 files changed

Lines changed: 1226 additions & 1273 deletions

azure.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ infra:
66
path: infra
77
services:
88
todo-app:
9-
project: src
9+
project: .
1010
host: appservice
1111
language: python

infra/main.bicep

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ param location string = resourceGroup().location
1010
@secure()
1111
param secretKey string = ''
1212

13-
@description('Database URL for the application')
14-
param databaseUrl string = ''
15-
1613
// Generate unique resource token
1714
var resourceToken = uniqueString(subscription().id, resourceGroup().id, location, environmentName)
1815

@@ -61,16 +58,18 @@ resource appService 'Microsoft.Web/sites@2024-04-01' = {
6158
reserved: true
6259
httpsOnly: true
6360
siteConfig: {
64-
linuxFxVersion: 'PYTHON|3.12'
65-
appCommandLine: 'gunicorn --bind=0.0.0.0 --timeout 600 --access-logfile \'-\' --error-logfile \'-\' main:app'
61+
linuxFxVersion: 'PYTHON|3.11'
62+
alwaysOn: true
63+
ftpsState: 'FtpsOnly'
64+
appCommandLine: 'python -m uvicorn main:app --host 0.0.0.0 --port 8000'
6665
appSettings: [
6766
{
6867
name: 'SECRET_KEY'
6968
value: secretKey
7069
}
7170
{
72-
name: 'DATABASE_URL'
73-
value: databaseUrl
71+
name: 'WEBSITES_PORT'
72+
value: '8000'
7473
}
7574
{
7675
name: 'SCM_DO_BUILD_DURING_DEPLOYMENT'
@@ -80,12 +79,15 @@ resource appService 'Microsoft.Web/sites@2024-04-01' = {
8079
name: 'ENABLE_ORYX_BUILD'
8180
value: 'true'
8281
}
82+
{
83+
name: 'PYTHONPATH'
84+
value: '/home/site/wwwroot'
85+
}
8386
]
8487
cors: {
8588
allowedOrigins: ['*']
8689
supportCredentials: false
8790
}
88-
alwaysOn: false
8991
healthCheckPath: '/health'
9092
}
9193
}
@@ -94,6 +96,8 @@ resource appService 'Microsoft.Web/sites@2024-04-01' = {
9496
// Outputs
9597
output RESOURCE_GROUP_ID string = resourceGroup().id
9698
output AZURE_LOCATION string = location
99+
output AZURE_TENANT_ID string = tenant().tenantId
100+
output AZURE_RESOURCE_GROUP string = resourceGroup().name
101+
output SERVICE_WEB_NAME string = appService.name
102+
output SERVICE_WEB_URI string = 'https://${appService.properties.defaultHostName}'
97103
output SERVICE_TODO_APP_IDENTITY_PRINCIPAL_ID string = appService.identity.principalId
98-
output SERVICE_TODO_APP_NAME string = appService.name
99-
output SERVICE_TODO_APP_URI string = 'https://${appService.properties.defaultHostName}'

infra/main.parameters.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
},
1111
"secretKey": {
1212
"value": "${SECRET_KEY}"
13-
},
14-
"databaseUrl": {
15-
"value": "${DATABASE_URL}"
1613
}
1714
}
1815
}

instance/todos.db

-8 KB
Binary file not shown.

0 commit comments

Comments
 (0)