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 2
2
import json
3
3
from time_tracker_api .security import current_user_email
4
4
from azure .appconfiguration import AzureAppConfigurationClient
5
+ from utils .environment_variables import check_variables_are_defined
5
6
6
7
7
8
class 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' ])
18
10
AZURE_APP_CONFIGURATION_CONNECTION_STRING = os .environ .get (
19
11
'AZURE_APP_CONFIGURATION_CONNECTION_STRING'
20
12
)
Original file line number Diff line number Diff line change @@ -15,4 +15,4 @@ pytest-mock==2.0.0
15
15
coverage==4.5.1
16
16
17
17
# Git hooks
18
- pre-commit==2.2.0
18
+ pre-commit==2.2.0
Original file line number Diff line number Diff line change 3
3
import requests
4
4
import json
5
5
from typing import List
6
+ from utils .environment_variables import check_variables_are_defined
6
7
7
8
8
9
class 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 )
22
19
23
- check_variables_are_defined ()
24
20
CLIENT_ID = os .environ .get ('MS_CLIENT_ID' )
25
21
AUTHORITY = os .environ .get ('MS_AUTHORITY' )
26
22
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