""" support reading the DB connection info from an environment var (used with Docker containers) DB_CONNECTION_STRING should contain the full Postgres URI """ db_connection_string = os.environ.get('DB_CONNECTION_STRING') if db_connection_string is not None: return db_connection_string else: return _config['secret']['sqlalchemy_url'] c = Config() _secret = SecretConfig() _config = parse_config(__file__) # outside this module, we use the above c global instead of using this directly def _unrepr(d): for opt in d: val = d[opt] if val in ['True', 'False']: d[opt] = ast.literal_eval(val) elif isinstance(val, str) and val.isdigit(): d[opt] = int(val) elif isinstance(d[opt], dict): _unrepr(d[opt]) _unrepr(_config['appconf']) c.APPCONF = _config['appconf'].dict()
from __future__ import unicode_literals import cherrypy from sideboard.lib import log, parse_config, render_with_templates, services from drafts_as_a_service._version import __version__ config = parse_config(__file__) from drafts_as_a_service import service services.register(service, "drafts_as_a_service") from drafts_as_a_service import sa services.register(sa.Session.crud, "drafts_as_a_service_crud") @render_with_templates(config["template_dir"]) class Root(object): def index(self): log.debug("this data will be used to render a template") return {"plugin": "drafts-as-a-service", "header": True} cherrypy.tree.mount(Root(), "/drafts_as_a_service")
from os.path import join from sideboard.lib import parse_config from uber.jinja import template_overrides from uber.utils import mount_site_sections, static_overrides from magwest._version import __version__ # noqa: F401 config = parse_config(__file__) mount_site_sections(config['module_root']) static_overrides(join(config['module_root'], 'static')) template_overrides(join(config['module_root'], 'templates')) # These need to come last so they can make use of config properties from magwest.automated_emails import * # noqa: F401,E402,F403
support reading the DB connection info from an environment var (used with Docker containers) DB_CONNECTION_STRING should contain the full Postgres URI """ db_connection_string = os.environ.get('DB_CONNECTION_STRING') if db_connection_string is not None: return db_connection_string else: return _config['secret']['sqlalchemy_url'] c = Config() _secret = SecretConfig() _config = parse_config( __file__ ) # outside this module, we use the above c global instead of using this directly def _unrepr(d): for opt in d: val = d[opt] if val in ['True', 'False']: d[opt] = ast.literal_eval(val) elif isinstance(val, str) and val.isdigit(): d[opt] = int(val) elif isinstance(d[opt], dict): _unrepr(d[opt]) _unrepr(_config['appconf'])
from os.path import join import cherrypy import uber from sideboard.lib import parse_config from uber.config import c, Config, dynamic from uber.errors import HTTPRedirect from uber.jinja import template_overrides from uber.models import Attendee, Session from uber.utils import mount_site_sections, static_overrides from magprime._version import __version__ # noqa: F401 magprime_config = parse_config(__file__) static_overrides(join(magprime_config['module_root'], 'static')) template_overrides(join(magprime_config['module_root'], 'templates')) @Config.mixin class ExtraConfig: @property @dynamic def SEASON_BADGE_PRICE(self): return self.BADGE_PRICE + self.SEASON_LEVEL @property def SEASON_EVENTS(self): return magprime_config['season_events'] @property