diff options
-rwxr-xr-x | buildtools/subst-vars.py | 28 | ||||
-rw-r--r-- | rpkid/Makefile.in | 10 | ||||
-rw-r--r-- | rpkid/portal-gui/Makefile.in | 6 | ||||
-rw-r--r-- | rpkid/portal-gui/settings.py (renamed from rpkid/portal-gui/settings.py.in) | 24 |
4 files changed, 14 insertions, 54 deletions
diff --git a/buildtools/subst-vars.py b/buildtools/subst-vars.py deleted file mode 100755 index 5083c2dd..00000000 --- a/buildtools/subst-vars.py +++ /dev/null @@ -1,28 +0,0 @@ -# $Id$ - -""" -Copyright (C) 2011 SPARTA, Inc., dba Cobham Analytic Solutions - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -""" - - -import os, sys - -# pull out all AC_* environment variables into a dict to substitute in the input file -d = {} -for v in os.environ: - if v.startswith('AC_'): - d[v] = os.environ[v] - -sys.stdout.write(sys.stdin.read() % d) diff --git a/rpkid/Makefile.in b/rpkid/Makefile.in index 5980d6bd..9ad7b4e8 100644 --- a/rpkid/Makefile.in +++ b/rpkid/Makefile.in @@ -69,7 +69,7 @@ BUILD_SCRIPTS = portal-gui/scripts/rpkigui-reset-demo \ AUX_SCRIPTS = -SETTINGS = portal-gui/settings.py portal-gui/rpki.wsgi +SETTINGS = portal-gui/local_settings.py portal-gui/rpki.wsgi all:: ${POW_SO} rpki/relaxng.py myrpki.rng rpki/sql_schemas.py ${SCRIPTS} ${AUX_SCRIPTS} ${SETTINGS} ${BUILD_SCRIPTS} @@ -287,8 +287,12 @@ portal-gui/rpki.wsgi: ${srcdir}/portal-gui/rpki.wsgi.in -e "s|@PYTHON""PATH@|${sysconfdir}/rpki|" \ ${srcdir}/portal-gui/rpki.wsgi.in > portal-gui/rpki.wsgi -portal-gui/settings.py: ${srcdir}/portal-gui/settings.py.in - ${COMPILE_SETTINGS} +portal-gui/local_settings.py: Makefile + ( echo 'import rpki.config'; \ + echo 'SECRET_KEY="${SECRET_KEY}"'; \ + echo 'STATIC_ROOT="${datarootdir}/rpki/media"'; \ + echo 'rpki.config.default_dirname="${sysconfdir}"'; \ + ) > portal-gui/local_settings.py portal-gui/scripts/rpki-manage: ${srcdir}/portal-gui/scripts/rpki-manage.in sed -e "s|@DJANGO""_ADMIN@|${DJANGO_ADMIN}|" \ diff --git a/rpkid/portal-gui/Makefile.in b/rpkid/portal-gui/Makefile.in index 7eb2e572..9e7fc85f 100644 --- a/rpkid/portal-gui/Makefile.in +++ b/rpkid/portal-gui/Makefile.in @@ -24,7 +24,7 @@ INSTDIR=${DESTDIR}$(datarootdir)/rpki SYSCONFDIR=${DESTDIR}${sysconfdir}/rpki # automatically built sources -BUILD=apache.conf +BUILD=apache.conf local_settings.py all: $(BUILD) @@ -53,6 +53,7 @@ install: $(BUILD) ${INSTALL} -m 644 apache.conf $(SYSCONFDIR)/apache.conf ${INSTALL} -m 644 rpki.wsgi $(INSTDIR)/wsgi/rpki.wsgi ${INSTALL} -m 644 settings.py ${SYSCONFDIR} + ${INSTALL} -m 644 local_settings.py ${SYSCONFDIR} # this would be better handled with "django-admin collectstatic" but makes the install # process harder for the end user. ${INSTALL} -m 644 $(srcdir)/../rpki/gui/app/static/css/* $(INSTDIR)/media/css @@ -61,7 +62,8 @@ install: $(BUILD) deinstall uninstall: rm -rf $(INSTDIR)/media $(INSTDIR)/wsgi - rm -rf $(SYSCONFDIR)/apache.conf $(SYSCONFDIR)/settings.py $(SYSCONFDIR)/settings.pyc + rm -rf $(SYSCONFDIR)/apache.conf $(SYSCONFDIR)/settings.py $(SYSCONFDIR)/settings.pyc \ + $(SYSCONFDIR)/local_settings.py $(SYSCONFDIR)/settings.pyc test: @true diff --git a/rpkid/portal-gui/settings.py.in b/rpkid/portal-gui/settings.py index 8246304c..ee4b5cee 100644 --- a/rpkid/portal-gui/settings.py.in +++ b/rpkid/portal-gui/settings.py @@ -1,23 +1,14 @@ -# -# Sample Django settings.py for running the RPKI portal gui. This -# template was written for Django 1.3. -# -# DO NOT EDIT! This file is automatically generated from -# settings.py.in - +# DO NOT EDIT! Modifications should be placed in local_settings.py __version__ = '$Id$' import rpki.config import os.path +from local_settings import * DEBUG = True TEMPLATE_DEBUG = DEBUG -# needs to be set prior to the call to rpki.config.parser so it knows -# where to find the system rpki.conf -rpki.config.default_dirname = '%(AC_SYSCONFDIR)s' - # load the sql authentication bits from the system rpki.conf rpki_config = rpki.config.parser(section='web_portal') @@ -36,10 +27,7 @@ def get_conv(): from MySQLdb.converters import conversions import types conv = conversions.copy() - # WARNING: the extra percents in the following line are due to the fact - # that this entire script is used as a format string to generate - # settings.py - conv[types.LongType] = lambda x, conv: "0x%%x" %% x + conv[types.LongType] = lambda x, conv: "0x%x" % x return conv DATABASES = { @@ -78,9 +66,6 @@ def select_tz(): # system time zone. TIME_ZONE = select_tz() -# Make this unique, and don't share it with anybody. -SECRET_KEY = '%(AC_SECRET_KEY)s' - # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', @@ -127,8 +112,5 @@ TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.static" ) -# where to put static files -STATIC_ROOT = '%(AC_DATAROOTDIR)s/rpki/media' - # must end with a slash! STATIC_URL = '/media/' |