Commit 212a4a95 authored by Chris McDonough's avatar Chris McDonough

Merge Stefan's ZOPE_CONFIG patch to the HEAD.

parent 78267434
...@@ -28,6 +28,9 @@ def configure(configfile): ...@@ -28,6 +28,9 @@ def configure(configfile):
configure('/path/to/configfile'); import Zope; app = Zope.app() """ configure('/path/to/configfile'); import Zope; app = Zope.app() """
import Zope.Startup import Zope.Startup
starter = Zope.Startup.get_starter() starter = Zope.Startup.get_starter()
if not configfile:
import os
configfile = os.getenv("ZOPE_CONFIG")
opts = _setconfig(configfile) opts = _setconfig(configfile)
starter.setConfiguration(opts.configroot) starter.setConfiguration(opts.configroot)
starter.setupSecurityOptions() starter.setupSecurityOptions()
......
...@@ -42,6 +42,12 @@ def startup(): ...@@ -42,6 +42,12 @@ def startup():
# Already began (and maybe finished) startup, so don't run again # Already began (and maybe finished) startup, so don't run again
return return
_began_startup = 1 _began_startup = 1
# Load configuration file from (optional) environment variable
# Also see http://zope.org/Collectors/Zope/1233
import os
configfile = os.environ.get('ZOPE_CONFIG')
if configfile is not None:
configure(configfile)
from Zope.App.startup import startup as _startup from Zope.App.startup import startup as _startup
_startup() _startup()
...@@ -71,4 +77,3 @@ import os ...@@ -71,4 +77,3 @@ import os
if os.environ.get('ZOPE_COMPATIBLE_STARTUP'): if os.environ.get('ZOPE_COMPATIBLE_STARTUP'):
# Open the database immediately (see comment above). # Open the database immediately (see comment above).
startup() startup()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment