You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
stacosys/app/conf/config.py

49 lines
765 B
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
6 years ago
import profig
# constants
FLASK_APP = "flask.app"
DB_URL = "main.db_url"
HTTP_HOST = "http.host"
HTTP_PORT = "http.port"
SECURITY_SALT = "security.salt"
SECURITY_SECRET = "security.secret"
MAIL_POLLING = "polling.newmail"
COMMENT_POLLING = "polling.newcomment"
# variable
params = dict()
def initialize(config_pathname, flask_app):
cfg = profig.Config(config_pathname)
cfg.sync()
params.update(cfg)
params.update({FLASK_APP: flask_app})
def get(key):
return params[key]
def getInt(key):
return int(params[key])
def _str2bool(v):
return v.lower() in ("yes", "true", "t", "1")
def getBool(key):
return _str2bool(params[key])
def flaskapp():
return params[FLASK_APP]