blob: ee9a986437b29f759e094d075ab34af66bc54f88 [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:
9# import og_config_DEV import og_config_STAGING import og_config_PROD
10#
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
19apps_path="/usr/share/pdk/bin"
20#apps_path="PREFIX/pdk/bin"
21
22config = configparser.ConfigParser(strict=False, allow_no_value=True)
23try:
24 config.read_string("[null]\n"+open("/etc/sysconfig/ef-config").read())
25except:
26 pass
27ef_variant = config.get('null','ef_variant', fallback='STAGING').strip('\'"')
28
29#
30# emulate: import og_config_<ef_variant>
31#
32#cfgModule = __import__("og_config_"+ef_variant)
33#globals().update(vars(cfgModule))