示例#1
0
class AppConfig(YamlConfig):
    __mapping__ = {
        'db': Attr('db', DatabaseConfig),
        'gunicorn': Attr('gunicorn', dict),
    }

    def __init__(self):
        self.db = DatabaseConfig()
        self.gunicorn = {}
示例#2
0
class ServerConfig(YamlConfig):
    __mapping__ = {
        'db': Attr('db', DatabaseConfig),
        'app': Attr('app', AppConfig),
    }

    def __init__(self):
        self.db = DatabaseConfig()
        self.app = AppConfig()
示例#3
0
class AppConfig(YamlConfig):
    __mapping__ = {
        'db': Attr('db', dict),
        'redis': Attr('redis', dict),
        'api': Attr('api', dict),
        'gunicorn': Attr('gunicorn', dict),
        'waitress': Attr('waitress', dict),
    }

    def __init__(self):
        self.gunicorn = {}
class AppConfig(YamlConfig):
    """
    Add mapping for our application config
    """
    __mapping__ = {
        'db': Attr('db', DatabaseConfig),
        'gunicorn': Attr('gunicorn', dict)
    }

    def __init__(self):
        self.db = DatabaseConfig()
        self.gunicorn = {}
示例#5
0
class LoggerConfig(YamlConfig):
    __mapping__ = {
        'file': Attr('file', str),
        'format': Attr('format', str),
        'level': Attr('level', str),
    }
    file = None
    level = 'INFO'
    format = '[L:%(lineno)d]# %(levelname)-8s [%(asctime)s]  %(message)s'

    @property
    def is_log_file(self):
        return self.file is not None
示例#6
0
class AppConfig(JsonConfig):
    __mapping__ = {
        "db": Attr("db", DatabaseConfig),
        "db_test": Attr("db_test", DatabaseConfig),
        "db_ci_test": Attr("db_ci_test", DatabaseConfig),
        "gunicorn": Attr("gunicorn", dict),
    }

    def __init__(self):
        self.db = DatabaseConfig()
        self.db_test = DatabaseConfig()
        self.db_ci_test = DatabaseConfig()
        self.gunicorn = {}
示例#7
0
class DatabaseConfig(YamlConfig):
    __mapping__ = {
        'host': Attr('host', str),
        'db': Attr('db', str),
        'user': Attr('user', str),
        'password': Attr('password', str),
        'port': Attr('port', int),
    }

    host = ''
    db = ''
    user = ''
    password = ''
    port = 3306
示例#8
0
class LDAPConfig(YamlConfig):
    __mapping__ = {
        'hostport': Attr('hostport', str),
        'user_prefix': Attr('user_prefix', str),
        'connect_timeout': Attr('connect_timeout', int),
    }
    hostport = None
    port = None
    user_prefix = ''
    connect_timeout = 10

    @property
    def is_ldap(self):
        return self.hostport is not None
示例#9
0
class AppConfig(YamlConfig):
    __mapping__ = {
        "db": Attr("db", DatabaseConfig),
        "gunicorn": Attr("gunicorn", dict),
        "version": Attr("version", str),
        "asn_path": Attr("asn_path", str),
        "geo_path": Attr("geo_path", str)
    }

    def __init__(self):
        self.db = DatabaseConfig()
        self.gunicorn = {}
        self.version = None
        self.asn_path = None
        self.geo_path = None
示例#10
0
class PotionConfig(YamlConfig):
    __mapping__ = {
        'gunicorn': Attr('gunicorn', dict),
        'swagger' : Attr('swagger', dict),
        'database': Attr('database', dict),
        'authentication': Attr('authentication', dict),
        'logging': Attr('logging', dict)
    }

    def __init__(self):
        self.gunicorn = {}
        self.swagger = {}
        self.database = {}
        self.authentication = {}
        self.logging = {}
示例#11
0
class AppConfig(YamlConfig):
    __mapping__ = {
        'db': Attr('db', DatabaseConfig),
    }

    def __init__(self):
        self.db = DatabaseConfig()
示例#12
0
class AppConfig(EnvYamlConfig):

    __mapping__ = {
        'bdb_file': Attr('bdb_file', str),
        'loom_path': Attr('loom_path', str),
        'table_name': Attr('table_name', str),
        'population_name': Attr('population_name', str),
        'backend': Attr('backend', str),
        'log_level': Attr('log_level', str),
        'history': Attr('history', dict),
        'gunicorn': Attr('gunicorn', dict),
    }
示例#13
0
class DatabaseConfig(YamlConfig):
    """
    Map the database connection to our application
    from the YAML config file
    """
    __mapping__ = {
        'connection': Attr('connection', str),
    }

    connection = ''
示例#14
0
class AppConfig(YamlConfig):
    __mapping__ = {
        'static_folder': Attr('static_folder', str),
        'session_secret': Attr('session_secret', str),
        'ldap': Attr('ldap', LDAPConfig),
        'logger': Attr('logger', LoggerConfig)
    }
    session_secret = 'yep_secret'
    static_folder = property()
    _static_folder = os.path.join(BASE_PATH, 'public')

    def __init__(self):
        self.logger = LoggerConfig()

    @static_folder.setter
    def static_folder(self, v):
        setattr(self, '_static_folder', v)

    @static_folder.getter
    def static_folder(self):
        return getattr(self, '_static_folder', '')
示例#15
0
class SecurityConfig(YamlConfig):
    __mapping__ = {
        'token_prefix': Attr('token_prefix', str),
        'token_expiry': Attr('token_expiry', int),
        'tokens_leeway': Attr('tokens_leeway', int),
        'tokens_authorize_endpoint': Attr('tokens_authorize_endpoint', str),
        'tokens_refresh_endpoint': Attr('tokens_refresh_endpoint', str),
        'tokens_enable_refresh': Attr('tokens_enable_refresh', bool),
        'secret': Attr('secret', str),
    }
    secret = 'secret'
    token_prefix = 'JWT'
    token_expiry = timedelta(hours=1)
    tokens_leeway = timedelta(seconds=0)
    tokens_enable_refresh = False
示例#16
0
class AppConfig(YamlConfig):
    __mapping__ = {
        'app': Attr('app', str),
        'api_version': Attr('api_version', str),
        'db': Attr('db', DatabaseWrapperConfig),
        'gunicorn': Attr('gunicorn', dict),
        'wsgiref': Attr('wsgiref', dict),
        'social_config': Attr('social_config', SocialOAuthConfig),
        'security': Attr('security', SecurityConfig)
    }

    def __init__(self):
        self.db = DatabaseConfig()
        self.gunicorn = {}
        self.social_oauth = {}
        self.app = 'aness'
        self.api = 'v_'
示例#17
0
class DatabaseWrapperConfig(YamlConfig):
    __mapping__ = {
        'sa': Attr('sa', DatabaseConfig),
        'pw': Attr('pw', DatabaseConfig),
    }
    connection = ''
示例#18
0
class DatabaseConfig(JsonConfig):
    __mapping__ = {
        "connection": Attr("connection", str),
    }

    connection = ""
示例#19
0
class DatabaseConfig(YamlConfig):
    __mapping__ = {
        'connection': Attr('connection', str),
    }
    connection = ''
示例#20
0
class DatabaseConfig(YamlConfig):
    __mapping__ = {"file_path": Attr("file_path", str)}

    connection = ""
示例#21
0
class SocialOAuthConfig(YamlConfig):
    __mapping__ = {
        'sites_list': Attr('sites_list', list),
        'base_url': Attr('base_url', str)
    }