-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
36 lines (26 loc) · 891 Bytes
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import yaml
from isi_sdk_8_2_2 import Configuration
import urllib3
# Suppress certificate warnings
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
class Config():
def __init__(self):
self.configuration = {}
@property
def quotas_db_file(self):
return(self.configuration['quotas_db_file'])
@quotas_db_file.setter
def quotas_db_file(self, value):
self.configuration['quotas_db_file'] = value
# instanciate the application configuration
config = Config()
# instanciate the apiconfig
isi_config = Configuration()
# and load the two configs with stuff from the yaml file
with open('instance/isi.yml', "r") as yamlfile:
c = yaml.safe_load(yamlfile)
isi_config.username = c['username']
isi_config.password = c['password']
isi_config.verify_ssl = c['verify_ssl']
isi_config.host = f"https://{c['host']}:8080"
config.quotas_db_file = c['quotas_db_file']