with open(os.path.expanduser(config_path)) as fp: config = SettingsDict(json.load(fp)) def child(key): return config.child(key) DEBUG = config.get_bool('DEBUG', True) REQUEST_LIMIT = int(config.get('REQUEST_LIMIT', 10)) OP_CONCURRENCY = int(config.get('OP_CONCURRENCY', 5)) logging_config = config.get('LOGGING', DEFAULT_LOGGING_CONFIG) logging.config.dictConfig(logging_config) SENTRY_DSN = config.get_nullable('SENTRY_DSN', None) analytics_config = config.child('ANALYTICS') MFR_IDENTIFYING_HEADER = analytics_config.get('MFR_IDENTIFYING_HEADER', 'X-Cos-Mfr-Render-Request') MFR_DOMAIN = analytics_config.get('MFR_DOMAIN', 'http://localhost:7778').rstrip('/') keen_config = analytics_config.child('KEEN') KEEN_API_BASE_URL = keen_config.get('API_BASE_URL', 'https://api.keen.io') KEEN_API_VERSION = keen_config.get('API_VERSION', '3.0') keen_private_config = keen_config.child('PRIVATE') KEEN_PRIVATE_PROJECT_ID = keen_private_config.get_nullable('PROJECT_ID', None) KEEN_PRIVATE_WRITE_KEY = keen_private_config.get_nullable('WRITE_KEY', None) keen_public_config = keen_config.child('PUBLIC') KEEN_PUBLIC_PROJECT_ID = keen_public_config.get_nullable('PROJECT_ID', None)
'root': { 'level': 'INFO', 'handlers': ['console'] } } try: config_path = os.environ['{}_CONFIG'.format(PROJECT_NAME.upper())] except KeyError: env = os.environ.get('ENV', 'test') config_path = '{}/{}-{}.json'.format(PROJECT_CONFIG_PATH, PROJECT_NAME, env) config = SettingsDict() config_path = os.path.expanduser(config_path) if not os.path.exists(config_path): logging.warning('No \'{}\' configuration file found'.format(config_path)) else: with open(os.path.expanduser(config_path)) as fp: config = SettingsDict(json.load(fp)) def child(key): return config.child(key) logging_config = config.get('LOGGING', DEFAULT_LOGGING_CONFIG) logging.config.dictConfig(logging_config) SENTRY_DSN = config.get_nullable('SENTRY_DSN', None)
'handlers': ['console'] } } try: config_path = os.environ['{}_CONFIG'.format(PROJECT_NAME.upper())] except KeyError: env = os.environ.get('ENV', 'test') config_path = '{}/{}-{}.json'.format(PROJECT_CONFIG_PATH, PROJECT_NAME, env) config = SettingsDict() config_path = os.path.expanduser(config_path) if not os.path.exists(config_path): logging.warning('No \'{}\' configuration file found'.format(config_path)) else: with open(os.path.expanduser(config_path)) as fp: config = SettingsDict(json.load(fp)) def child(key): return config.child(key) logging_config = config.get('LOGGING', DEFAULT_LOGGING_CONFIG) logging.config.dictConfig(logging_config) SENTRY_DSN = config.get_nullable('SENTRY_DSN', None) GOOGLE_ANALYTICS_TRACKING_ID = config.get_nullable( 'GOOGLE_ANALYTICS_TRACKING_ID', None)