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

@ -144,7 +144,7 @@ tmp_upload_dir = None
# Logging
#
# logfile - The path to a log file to write to.
#
#
# A path string. "-" means log to stdout.
#
# loglevel - The granularity of log output

View File

@ -102,6 +102,19 @@ class Application(object):
return self.callable
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:
debug.spew()
if self.cfg.daemon:

View File

@ -507,6 +507,17 @@ class Spew(Setting):
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):
name = "preload_app"
section = "Server Mechanics"