blob: 748517108137258d231a9c954e95572a376e86bf [file] [log] [blame]
emayecs5966a532021-07-29 10:07:02 -04001# Configuration values for the OpenGalaxy machines
2# Select config-file directed by OPTIONAL (INI file): /etc/sysconfig/ef-config ef_variant= line.
3# File should: have no [section] header, use "# " comments, var="val" (no spaces around =),
4# no dash in var-names, for good compatibility between python and bash.
5#
6# default if fail to read/parse the etc file is STAGING. These values:
7# ef_variant=DEV ef_variant=STAGING ef_variant=PROD
8# yield respectively:
emayecsb2487ae2021-08-05 10:30:13 -04009# import config_DEV import config_STAGING import config_PROD
emayecs5966a532021-07-29 10:07:02 -040010#
11# Survive (try:) missing,improper,unreadable /etc/sysconfig/ef-config.
12# DO NOT survive (no try:) failed imports (non-existent file, bad syntax, etc.).
13
14#
15# look-up ef_variant=... in optional etc file, default to STAGING
16#
17import configparser
18#TODO: replace path with PREFIX
emayecs4c806452021-09-01 20:00:51 -040019apps_path="PREFIX/pdk/bin"
emayecs5966a532021-07-29 10:07:02 -040020
21config = configparser.ConfigParser(strict=False, allow_no_value=True)
22try:
23 config.read_string("[null]\n"+open("/etc/sysconfig/ef-config").read())
24except:
25 pass
26ef_variant = config.get('null','ef_variant', fallback='STAGING').strip('\'"')
27
28#
emayecsb2487ae2021-08-05 10:30:13 -040029# emulate: import config_<ef_variant>
emayecs5966a532021-07-29 10:07:02 -040030#
emayecsb2487ae2021-08-05 10:30:13 -040031#cfgModule = __import__("config_"+ef_variant)
emayecs5966a532021-07-29 10:07:02 -040032#globals().update(vars(cfgModule))