Introduce TILDE_CONF environment variable

pull/1/head
darksider3 5 years ago
parent e5aae6bdc3
commit 3971ed88e8

@ -22,13 +22,20 @@ def debugExec(commands):
# @TODO hardcoded config? # @TODO hardcoded config?
cwd = os.getcwd() + "/applicationsconfig.ini" cwd = os.environ.get('TILDE_CONF')
if cwd is None:
cwd=os.getcwd()+"/applicationsconfig.ini"
else:
if os.path.isfile(cwd) is False:
cwd=os.getcwd()+"/applicationsconfig.ini"
# cwd is now either cwd/applicationsconfig or $TILDE_CONF
argparser = argparse.ArgumentParser(description = 'interactive registration formular for tilde platforms') argparser = argparse.ArgumentParser(description = 'interactive registration formular for tilde platforms')
argparser.add_argument('-c', '--config', default = cwd, argparser.add_argument('-c', '--config', default = cwd,
type = str, help = 'Path to configuration file', required = False) type = str, help = 'Path to configuration file', required = False)
args = argparser.parse_args() args = argparser.parse_args()
CONF_FILE = args.config CONF_FILE = args.config
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read(CONF_FILE) config.read(CONF_FILE)

@ -2,12 +2,19 @@
import re, configparser, logging, sqlite3, argparse import re, configparser, logging, sqlite3, argparse
from os import getcwd from os import getcwd
from os import environ
from os import path as ospath
import re, configparser, logging, sqlite3 import re, configparser, logging, sqlite3
try: try:
cwd=getcwd()+"/applicationsconfig.ini" cwd = environ.get('TILDE_CONF')
if cwd is None:
cwd=getcwd()+"/applicationsconfig.ini"
else:
if ospath.isfile(cwd) is False:
cwd=getcwd()+"/applicationsconfig.ini"
# cwd is now either cwd/applicationsconfig or $TILDE_CONF
argparser = argparse.ArgumentParser(description='interactive registration formular for tilde platforms') argparser = argparse.ArgumentParser(description='interactive registration formular for tilde platforms')
argparser.add_argument('-c', '--config', default=cwd, type=str, help='Config file', required=False) argparser.add_argument('-c', '--config', default=cwd, type=str, help='Config file', required=False)
args = argparser.parse_args() args = argparser.parse_args()

Loading…
Cancel
Save