Browse Source

Introduce TILDE_CONF environment variable

master^2
darksider3 2 years ago
parent
commit
3971ed88e8
  1. 9
      admin/administrate.py
  2. 11
      application/userapplication.py

9
admin/administrate.py

@ -22,13 +22,20 @@ def debugExec(commands):
# @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.add_argument('-c', '--config', default = cwd,
type = str, help = 'Path to configuration file', required = False)
args = argparser.parse_args()
CONF_FILE = args.config
config = configparser.ConfigParser()
config.read(CONF_FILE)

11
application/userapplication.py

@ -2,12 +2,19 @@
import re, configparser, logging, sqlite3, argparse
from os import getcwd
from os import environ
from os import path as ospath
import re, configparser, logging, sqlite3
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.add_argument('-c', '--config', default=cwd, type=str, help='Config file', required=False)
args = argparser.parse_args()

Loading…
Cancel
Save