Browse Source

Make settings.ini path configurable via env variable

pull/2/head
Noah Petherbridge 4 years ago
parent
commit
413d527a3e
2 changed files with 7 additions and 2 deletions
  1. 5
    1
      app.wsgi
  2. 2
    1
      rophako/settings.py

+ 5
- 1
app.wsgi View File

@@ -12,6 +12,10 @@ sys.path.append(".")
12 12
 activate_this = os.environ['HOME']+'/.virtualenv/rophako/bin/activate_this.py'
13 13
 execfile(activate_this, dict(__file__=activate_this))
14 14
 
15
-from rophako.app import app as application
15
+def application(environ, start_response):
16
+    if "ROPHAKO_SETTINGS" in environ:
17
+        os.environ["ROPHAKO_SETTINGS"] = environ["ROPHAKO_SETTINGS"]
18
+    from rophako.app import app as _application
19
+    return _application(environ, start_response)
16 20
 
17 21
 # vim:ft=python

+ 2
- 1
rophako/settings.py View File

@@ -27,7 +27,8 @@ class ConfigHandler(object):
27 27
         self.settings.set("DEFAULT", "_year", str(datetime.datetime.now().strftime("%Y")))
28 28
 
29 29
         # Read the defaults and then apply the custom settings on top.
30
-        self.settings.read(["defaults.ini", "settings.ini"])
30
+        settings_file = os.environ.get("ROPHAKO_SETTINGS", "settings.ini")
31
+        self.settings.read(["defaults.ini", settings_file])
31 32
 
32 33
     def print_settings(self):
33 34
         """Pretty-print the contents of the configuration as JSON."""

Loading…
Cancel
Save