Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

repomand's config file locations are hardcoded #5

Merged
merged 3 commits into from

2 participants

@jdmaturen

Added --logging-config and --web-config params to repoman.server.main. Also fixed a typo in the example web.conf.

JD Maturen added some commits
@JeremyGrosser JeremyGrosser merged commit b9073b8 into JeremyGrosser:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 27, 2011
  1. make logging.conf and web.conf cli options

    JD Maturen authored
  2. derp

    JD Maturen authored
  3. fix example web.conf

    JD Maturen authored
This page is out of date. Refresh to see the latest.
Showing with 27 additions and 13 deletions.
  1. +1 −1  conf/web.conf
  2. +16 −8 repoman/config.py
  3. +10 −4 repoman/server.py
View
2  conf/web.conf
@@ -1,7 +1,7 @@
{
"repository": {
"path": "/var/lib/debianrepo",
- "signkey": "buildbot@example.com"
+ "signkey": "buildbot@example.com",
"gpghome": "/root/.gnupg"
},
"buildbot": {
View
24 repoman/config.py
@@ -1,6 +1,5 @@
import logging
import logging.config
-logging.config.fileConfig('/etc/repoman/logging.conf')
import os.path
import sys
@@ -11,16 +10,25 @@
import simplejson as json
config = None
-for filename in ('web.conf', '/etc/repoman/web.conf'):
- if os.path.exists(filename):
- config = json.load(file(filename, 'r'))
- break
-if not config:
- logging.critical('Unable to load a config file. Exiting.')
- sys.exit(0)
+def set_log_conf(logging_conf):
+ logging.config.fileConfig(logging_conf)
+
+def set_web_conf(web_conf):
+ """"""
+ global config # lulz
+ if os.path.exists(web_conf):
+ config = json.load(file(web_conf, 'r'))
+
+ if not config:
+ logging.critical('Unable to load config file. Exiting.')
+ sys.exit(0)
def conf(key):
+ if config is None:
+ logging.critical('Config not loaded. Exiting.')
+ sys.exit(0)
+
obj = config
for k in key.split('.'):
obj = obj[k]
View
14 repoman/server.py
@@ -1,14 +1,16 @@
#!/usr/bin/env python
import sys
-
import daemon
-from repoman.config import conf
+from optparse import OptionParser
+
+from repoman.config import conf, set_log_conf, set_web_conf
from repoman.wsgi import get_server
from repoman import repository
from repoman import buildbot
+
def get_context():
context = {'working_directory': '.',
'detach_process': False}
@@ -24,9 +26,13 @@ def get_context():
return daemon.DaemonContext(**context)
-
-
def main():
+ parser = OptionParser()
+ parser.add_option("-l", "--logging-config", help="Logging config file", default="/etc/repoman/logging.conf")
+ parser.add_option("-w", "--web-config", help="Web config file", default="/etc/repoman/web.conf")
+ (options, args) = parser.parse_args()
+ set_log_conf(options.logging_config)
+ set_web_conf(options.web_config)
with get_context():
get_server().serve_forever()
Something went wrong with that request. Please try again.