Make current migrations work with postgresql

This commit is contained in:
Tim Möhlmann
2018-11-19 19:10:38 +02:00
parent 2ced020513
commit 9b9f3731f6
7 changed files with 28 additions and 16 deletions

View File

@@ -73,14 +73,20 @@ class ConfigManager(dict):
key: os.environ.get(key, value)
for key, value in DEFAULT_CONFIG.items()
})
if self.config['SQL_FLAVOR'] != 'sqlite'
if self.config['DB_FLAVOR'] != 'sqlite':
self.setsql()
app.config = self
def setsql(self)
if not self.config['DB_PW']
def setsql(self):
if not self.config['DB_PW']:
self.config['DB_PW'] = self.config['SECRET_KEY']
self.config['SQLALCHEMY_DATABASE_URI'] = '{driver}://{user}:{pw}@{url}/{db}'.format(driver=DB_FLAVOR,user=DB_USER,pw=DB_PW,url=DB_URL,db=DB_NAME)
self.config['SQLALCHEMY_DATABASE_URI'] = '{driver}://{user}:{pw}@{url}/{db}'.format(
driver=self.config['DB_FLAVOR'],
user=self.config['DB_USER'],
pw=self.config['DB_PW'],
url=self.config['DB_URL'],
db=self.config['DB_NAME']
)
def setdefault(self, key, value):
if key not in self.config: