diff options
| author | termie <github@anarkystic.com> | 2012-01-09 15:37:31 -0800 |
|---|---|---|
| committer | termie <github@anarkystic.com> | 2012-01-09 15:37:31 -0800 |
| commit | 1d6334d3c25a815797fa040aa2ae3451ea3075d7 (patch) | |
| tree | fabfc397c5304d3e74960846a5513587ea8add24 | |
| parent | 74170ee7b4504748c5842a7935e64133970f587f (diff) | |
some more config in bin/keystone
| -rwxr-xr-x | bin/keystone | 21 | ||||
| -rw-r--r-- | keystone/config.py | 5 |
2 files changed, 16 insertions, 10 deletions
diff --git a/bin/keystone b/bin/keystone index 35514b6f..881e5175 100755 --- a/bin/keystone +++ b/bin/keystone @@ -25,7 +25,7 @@ from keystone import wsgi CONF = config.CONF -def create_server(name, port): +def create_server(conf, name, port): app = deploy.loadapp('config:%s' % conf, name=name) return wsgi.Server(app, port) @@ -42,18 +42,25 @@ def serve(*servers): if __name__ == '__main__': - default_conf = os.path.join(possible_topdir, + dev_conf = os.path.join(possible_topdir, 'etc', 'keystone.conf') - CONF(config_files=[default_conf]) + config_files = None + if os.path.exists(dev_conf): + config_files = [dev_conf] + + CONF(config_files=config_files) + + # TODO(termie): configure this based on config logging.getLogger().setLevel(logging.DEBUG) - conf = len(sys.argv) > 1 and sys.argv[1] or default_conf - options = deploy.appconfig('config:%s' % conf) + options = deploy.appconfig('config:%s' % CONF.config_file[0]) servers = [] - servers.append(create_server('admin', + servers.append(create_server(CONF.config_file[0], + 'admin', int(options['admin_port']))) - servers.append(create_server('main', + servers.append(create_server(CONF.config_file[0], + 'main', int(options['public_port']))) serve(*servers) diff --git a/keystone/config.py b/keystone/config.py index 7ce9f3ca..89ad57a9 100644 --- a/keystone/config.py +++ b/keystone/config.py @@ -5,9 +5,8 @@ from keystone import cfg class Config(cfg.ConfigOpts): def __call__(self, config_files=None, *args, **kw): - if config_files is None: - config_files = [] - self.config_file = config_files + if config_files is not None: + self.config_file = config_files super(Config, self).__call__(*args, **kw) def __getitem__(self, key, default=None): |
