File tree Expand file tree Collapse file tree 4 files changed +22
-25
lines changed
requirements/time_tracker_api Expand file tree Collapse file tree 4 files changed +22
-25
lines changed Original file line number Diff line number Diff line change 22import json
33from time_tracker_api .security import current_user_email
44from azure .appconfiguration import AzureAppConfigurationClient
5+ from utils .environment_variables import check_variables_are_defined
56
67
78class FeatureToggleConfig :
8- def check_variables_are_defined ():
9- azure_app_variable = 'AZURE_APP_CONFIGURATION_CONNECTION_STRING'
10- if azure_app_variable not in os .environ :
11- raise EnvironmentError (
12- "{} is not defined in the environment" .format (
13- azure_app_variable
14- )
15- )
16-
17- check_variables_are_defined ()
9+ check_variables_are_defined (['AZURE_APP_CONFIGURATION_CONNECTION_STRING' ])
1810 AZURE_APP_CONFIGURATION_CONNECTION_STRING = os .environ .get (
1911 'AZURE_APP_CONFIGURATION_CONNECTION_STRING'
2012 )
Original file line number Diff line number Diff line change @@ -15,4 +15,4 @@ pytest-mock==2.0.0
1515coverage==4.5.1
1616
1717# Git hooks
18- pre-commit==2.2.0
18+ pre-commit==2.2.0
Original file line number Diff line number Diff line change 33import requests
44import json
55from typing import List
6+ from utils .environment_variables import check_variables_are_defined
67
78
89class MSConfig :
9- def check_variables_are_defined ():
10- auth_variables = [
11- 'MS_CLIENT_ID' ,
12- 'MS_AUTHORITY' ,
13- 'MS_SECRET' ,
14- 'MS_SCOPE' ,
15- 'MS_ENDPOINT' ,
16- ]
17- for var in auth_variables :
18- if var not in os .environ :
19- raise EnvironmentError (
20- "{} is not defined in the environment" .format (var )
21- )
10+ ms_variables = [
11+ 'MS_CLIENT_ID' ,
12+ 'MS_AUTHORITY' ,
13+ 'MS_SECRET' ,
14+ 'MS_SCOPE' ,
15+ 'MS_ENDPOINT' ,
16+ ]
17+
18+ check_variables_are_defined (ms_variables )
2219
23- check_variables_are_defined ()
2420 CLIENT_ID = os .environ .get ('MS_CLIENT_ID' )
2521 AUTHORITY = os .environ .get ('MS_AUTHORITY' )
2622 SECRET = os .environ .get ('MS_SECRET' )
Original file line number Diff line number Diff line change 1+ import os
2+
3+
4+ def check_variables_are_defined (variables ):
5+ for var in variables :
6+ if var not in os .environ :
7+ raise EnvironmentError (
8+ "{} is not defined in the environment" .format (var )
9+ )
You can’t perform that action at this time.
0 commit comments