-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
45 lines (35 loc) · 1.26 KB
/
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
37
38
39
40
41
42
43
44
45
from uploader.configutil import get_config_file, set_config_from_yaml
# Specifiy config fields and defaults
config_fields = {
"host": "0.0.0.0",
"port": "5000",
"debug": False,
"secret_key": "you-shall-not-pass🧙<200d>♂️",
"data_directory": None,
"transfer_source_directory": None,
"storage_server_url": None,
"storage_server_user": None,
"storage_server_api_key": None,
"storage_server_basic_auth_user": None,
"storage_server_basic_auth_password": None,
"dataverse_server": "https://dataverse.nl/dataverse/",
"dataverse_demo_server": "https://demo.dataverse.nl/dataverse/",
"dataverse_api_key": None,
"demo_mode": True,
"depositor_name": "ANON",
"divisions": {},
}
# Initialize configuration
class Config:
TESTING = False
# Populate config with values from YAML file, if available
config_filepath = get_config_file()
try:
print(f"Attempting to read config file {config_filepath}...\n")
set_config_from_yaml(Config, config_fields, config_filepath)
except (FileNotFoundError, IOError):
print(
f"*** WARNING: {config_filepath} does not exist, using default configuration (see README.md). ***\n"
)
# Expose configuration values as module constant
CONFIGS = {"default": Config}