File tree Expand file tree Collapse file tree 3 files changed +16
-19
lines changed
Expand file tree Collapse file tree 3 files changed +16
-19
lines changed Original file line number Diff line number Diff line change 11import os
22import json
33from time_tracker_api .security import current_user_email
4+ from time_tracker_api .config import check_if_env_variables_are_defined
45from azure .appconfiguration import AzureAppConfigurationClient
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_if_env_variables_are_defined (
10+ env_vars = ['AZURE_APP_CONFIGURATION_CONNECTION_STRING' ]
11+ )
1812 AZURE_APP_CONFIGURATION_CONNECTION_STRING = os .environ .get (
1913 'AZURE_APP_CONFIGURATION_CONNECTION_STRING'
2014 )
Original file line number Diff line number Diff line change 55DISABLE_STR_VALUES = ("false" , "0" , "disabled" )
66
77
8+ def check_if_env_variables_are_defined (env_vars ):
9+ for var in env_vars :
10+ if var not in os .environ :
11+ raise EnvironmentError (
12+ "{} is not defined in the environment" .format (var )
13+ )
14+
15+
816class Config :
917 SECRET_KEY = get_or_generate_dev_secret_key ()
1018 SQL_DATABASE_URI = os .environ .get ('SQL_DATABASE_URI' )
Original file line number Diff line number Diff line change 33import requests
44import json
55from typing import List
6+ from time_tracker_api .config import check_if_env_variables_are_defined
67
78
89class MSConfig :
9- def check_variables_are_defined ():
10- auth_variables = [
10+ check_if_env_variables_are_defined (
11+ env_vars = [
1112 'MS_CLIENT_ID' ,
1213 'MS_AUTHORITY' ,
1314 'MS_SECRET' ,
1415 'MS_SCOPE' ,
1516 'MS_ENDPOINT' ,
1617 ]
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- )
22-
23- check_variables_are_defined ()
18+ )
2419 CLIENT_ID = os .environ .get ('MS_CLIENT_ID' )
2520 AUTHORITY = os .environ .get ('MS_AUTHORITY' )
2621 SECRET = os .environ .get ('MS_SECRET' )
You can’t perform that action at this time.
0 commit comments