File tree 2 files changed +13
-13
lines changed
2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change 3
3
from azure .identity import DefaultAzureCredential
4
4
5
5
def get_conn ():
6
- if 'WEBSITE_HOSTNAME' in os .environ :
7
- # Azure hosted, refresh token that becomes password.
8
- azure_credential = DefaultAzureCredential ()
9
- # Get token for Azure Database for PostgreSQL
10
- print ("Get password token." )
11
- token = azure_credential .get_token ("https://ossrdbms-aad.database.windows.net" )
12
- conn = str (current_app .config .get ('DATABASE_URI' )).replace ('PASSWORDORTOKEN' , token .token )
13
- return conn
14
- else :
15
- # Locally, read password from environment variable.
16
- print ("Read password env variable." )
17
- conn = str (current_app .config .get ('DATABASE_URI' )).replace ('PASSWORDORTOKEN' , os .environ ['DBPASS' ])
18
- return conn
6
+ # Azure hosted, refresh token that becomes password.
7
+ azure_credential = DefaultAzureCredential ()
8
+ # Get token for Azure Database for PostgreSQL
9
+ print ("Get password token." )
10
+ token = azure_credential .get_token ("https://ossrdbms-aad.database.windows.net/.default" )
11
+ conn = str (current_app .config .get ('DATABASE_URI' )).replace ('PASSWORDORTOKEN' , token .token )
12
+ return conn
Original file line number Diff line number Diff line change
1
+ #! /bin/bash -v
2
+ pip install -r requirements.txt
3
+
4
+ flask db upgrade
5
+
6
+ gunicorn --workers 2 --threads 4 --timeout 60 --access-logfile ' -' --error-logfile ' -' --bind=0.0.0.0:5000 --chdir=/home/site/wwwroot app:app
You can’t perform that action at this time.
0 commit comments