Make settings.ini path configurable via env variable
This commit is contained in:
parent
29d178793d
commit
413d527a3e
6
app.wsgi
6
app.wsgi
|
@ -12,6 +12,10 @@ sys.path.append(".")
|
||||||
activate_this = os.environ['HOME']+'/.virtualenv/rophako/bin/activate_this.py'
|
activate_this = os.environ['HOME']+'/.virtualenv/rophako/bin/activate_this.py'
|
||||||
execfile(activate_this, dict(__file__=activate_this))
|
execfile(activate_this, dict(__file__=activate_this))
|
||||||
|
|
||||||
from rophako.app import app as application
|
def application(environ, start_response):
|
||||||
|
if "ROPHAKO_SETTINGS" in environ:
|
||||||
|
os.environ["ROPHAKO_SETTINGS"] = environ["ROPHAKO_SETTINGS"]
|
||||||
|
from rophako.app import app as _application
|
||||||
|
return _application(environ, start_response)
|
||||||
|
|
||||||
# vim:ft=python
|
# vim:ft=python
|
||||||
|
|
|
@ -27,7 +27,8 @@ class ConfigHandler(object):
|
||||||
self.settings.set("DEFAULT", "_year", str(datetime.datetime.now().strftime("%Y")))
|
self.settings.set("DEFAULT", "_year", str(datetime.datetime.now().strftime("%Y")))
|
||||||
|
|
||||||
# Read the defaults and then apply the custom settings on top.
|
# Read the defaults and then apply the custom settings on top.
|
||||||
self.settings.read(["defaults.ini", "settings.ini"])
|
settings_file = os.environ.get("ROPHAKO_SETTINGS", "settings.ini")
|
||||||
|
self.settings.read(["defaults.ini", settings_file])
|
||||||
|
|
||||||
def print_settings(self):
|
def print_settings(self):
|
||||||
"""Pretty-print the contents of the configuration as JSON."""
|
"""Pretty-print the contents of the configuration as JSON."""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user