# -*- coding:utf-8 -*- import os import re import logging.config from armory.marine.json import ArmoryJson from armory.marine.parser import FreeConfigParser SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) # firstly, load config file to initialize constant SECTION = 'resource-console-service' cp = FreeConfigParser() cp.read([os.path.join(SITE_ROOT, "conf/online.cfg")]) DEBUG = cp.getboolean(SECTION, 'debug', default=True) EXCEPTION_DEBUG = cp.getboolean(SECTION, 'exception_debug', default=False) MONGO_CONFIG = cp.get(SECTION, 'mongo_config', default=None) LOG_ROOT = cp.get(SECTION, 'log_root', default='/tmp') LOG_FILE = os.path.join(LOG_ROOT, 'online_admin.log') LOG_ERR_FILE = os.path.join(LOG_ROOT, 'online_admin.err') PAGE_LIMIT = int(cp.get(SECTION, 'page_limit', default=10)) MEDIA_ROOT = '/var/app/data/resource_console_service' # secondly, construct logging config dict LOGGING_DICT = { 'version': 1, 'disable_existing_loggers': False,
# -*- coding:utf-8 -*- import os import json import re import logging.config # from provisionadmin_service.model.base import ModelBase from armory.marine.parser import FreeConfigParser SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) # firstly, load config file to initialize constant SECTION = 'cm-console-service' cp = FreeConfigParser() cp.read([os.path.join(SITE_ROOT, "conf/online.cfg")]) DEBUG = cp.getboolean(SECTION, 'debug', default=True) EXCEPTION_DEBUG = cp.getboolean(SECTION, 'exception_debug', default=False) MONGO_CONFIG = cp.get(SECTION, 'mongo_config', default=None) LOG_ROOT = cp.get(SECTION, 'log_root', default='/tmp') LOG_FILE = os.path.join(LOG_ROOT, 'online_admin.log') LOG_ERR_FILE = os.path.join(LOG_ROOT, 'online_admin.err') PAGE_LIMIT = cp.get(SECTION, 'page_limit', default=10) HTTP_PORT = cp.get(SECTION, 'http_port', default=6000) HOST = cp.get(SECTION, 'host') RULE_SERVICE_HOST = cp.get(SECTION, 'rule_service_host') AUTH_SERVICE_HOST = cp.get(SECTION, 'auth_service_host') RESOURCE_SERVICE_HOST = cp.get(SECTION, 'resource_service_host')