add --check-config option to check the config and app loading.
This commit is contained in:
benoitc 2012-02-20 11:13:59 +01:00
parent 7a1c58f236
commit cc26270783
3 changed files with 25 additions and 1 deletions

View File

@ -102,6 +102,19 @@ class Application(object):
return self.callable return self.callable
def run(self): def run(self):
if self.cfg.check_config:
try:
self.load()
except:
sys.stderr.write("\nError while loading the application:\n\n")
traceback.print_exc()
sys.stderr.flush()
sys.exit(1)
sys.exit(0)
if self.cfg.spew: if self.cfg.spew:
debug.spew() debug.spew()
if self.cfg.daemon: if self.cfg.daemon:

View File

@ -507,6 +507,17 @@ class Spew(Setting):
This is the nuclear option. This is the nuclear option.
""" """
class ConfigCheck(Setting):
name = "check_config"
section = "Debugging"
cli = ["--check-config",]
validator = validate_bool
action = "store_true"
default = False
desc = """\
Check the configuration..
"""
class PreloadApp(Setting): class PreloadApp(Setting):
name = "preload_app" name = "preload_app"
section = "Server Mechanics" section = "Server Mechanics"