import toml def load_config(path): contents = toml.load(path) result = { 'SQLALCHEMY_DATABASE_URI': contents['database']['postgres_url'], 'SECRET_KEY': contents['server']['secret_key'], 'MAIL_SERVER': contents['email']['smtp_server'], 'MAIL_PORT': contents['email']['smtp_port'], 'MAIL_USE_TLS': contents['email']['smtp_tls'], 'SECURITY_REGISTERABLE': True, 'SECURITY_PASSWORD_SALT': contents['server']['secret_key'] } return result