From: Simo Sorce Date: Thu, 13 Mar 2014 20:05:46 +0000 (-0400) Subject: Better handling of configuration file X-Git-Tag: v0.2.2~80 X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fipsilon.git;a=commitdiff_plain;h=28a9f2009c5a418271bc101ce775c4204c9de2e3 Better handling of configuration file allow to pass it on the command line or to look for it in well known locations. Signed-off-by: Simo Sorce --- diff --git a/ipsilon/idpserver.py b/ipsilon/idpserver.py index f9fb527..beb1a92 100755 --- a/ipsilon/idpserver.py +++ b/ipsilon/idpserver.py @@ -28,7 +28,17 @@ from ipsilon.util import page from ipsilon.root import Root from jinja2 import Environment, FileSystemLoader -cherrypy.config.update('ipsilon.conf') +cfgfile = None +if (len(sys.argv) > 1): + cfgfile = sys.argv[-1] +elif os.path.isfile('ipsilon.conf'): + cfgfile = 'ipsilon.conf' +elif os.path.isfile('/etc/ipsilon/ipsilon.conf'): + cfgfile = '/etc/ipsilon/ipsilon.conf' +else: + raise IOError("Configuration file not found") + +cherrypy.config.update(cfgfile) datastore = Store() admin_config = datastore.get_admin_config()