aboutsummaryrefslogtreecommitdiff
path: root/rpki/irdbd.py
diff options
context:
space:
mode:
Diffstat (limited to 'rpki/irdbd.py')
-rw-r--r--rpki/irdbd.py29
1 files changed, 5 insertions, 24 deletions
diff --git a/rpki/irdbd.py b/rpki/irdbd.py
index d53ae67c..856f91bf 100644
--- a/rpki/irdbd.py
+++ b/rpki/irdbd.py
@@ -166,7 +166,7 @@ class main(object):
rpki.log.init("irdbd", args)
- self.cfg = rpki.config.parser(args.config, "irdbd")
+ self.cfg = rpki.config.parser(set_filename = args.config, section = "irdbd")
self.cfg.set_global_flags()
if not args.foreground:
@@ -185,34 +185,15 @@ class main(object):
def main(self):
- global rpki # pylint: disable=W0602
- from django.conf import settings
-
startup_msg = self.cfg.get("startup-message", "")
if startup_msg:
logger.info(startup_msg)
- # Do -not- turn on DEBUG here except for short-lived tests,
- # otherwise irdbd will eventually run out of memory and crash.
- #
- # If you must enable debugging, use django.db.reset_queries() to
- # clear the query list manually, but it's probably better just to
- # run with debugging disabled, since that's the expectation for
- # production code.
- #
- # https://docs.djangoproject.com/en/dev/faq/models/#why-is-django-leaking-memory
-
- settings.configure(
- DATABASES = {
- "default" : {
- "ENGINE" : "django.db.backends.mysql",
- "NAME" : self.cfg.get("sql-database"),
- "USER" : self.cfg.get("sql-username"),
- "PASSWORD" : self.cfg.get("sql-password"),
- "HOST" : "",
- "PORT" : "" }},
- INSTALLED_APPS = ("rpki.irdb",),)
+ # Now that we know which configuration file to use, it's OK to
+ # load modules that require Django's settings module.
+ os.environ.update(DJANGO_SETTINGS_MODULE = "rpki.django_settings")
+ global rpki # pylint: disable=W0602
import rpki.irdb # pylint: disable=W0621
# Entirely too much fun with read-only access to transactional databases.