[config] add port-config for database
This commit is contained in:
parent
06237754f1
commit
29157dbc03
|
@ -9,7 +9,7 @@ from flaschengeist import _module_path, logger
|
|||
|
||||
|
||||
# Default config:
|
||||
config = {}
|
||||
config = {"DATABASE": {"port": 3306}}
|
||||
|
||||
|
||||
def update_dict(d, u):
|
||||
|
@ -66,11 +66,12 @@ def configure_app(app, test_config=None):
|
|||
app.config["SECRET_KEY"] = config["FLASCHENGEIST"]["secret_key"]
|
||||
|
||||
if test_config is None:
|
||||
app.config["SQLALCHEMY_DATABASE_URI"] = "mysql://{user}:{passwd}@{host}/{database}".format(
|
||||
app.config["SQLALCHEMY_DATABASE_URI"] = "mysql://{user}:{passwd}@{host}:{port}/{database}".format(
|
||||
user=config["DATABASE"]["user"],
|
||||
passwd=config["DATABASE"]["password"],
|
||||
host=config["DATABASE"]["host"],
|
||||
database=config["DATABASE"]["database"],
|
||||
port=config["DATABASE"]["port"],
|
||||
)
|
||||
else:
|
||||
app.config["SQLALCHEMY_DATABASE_URI"] = f"sqlite+pysqlite://{config['DATABASE']['file_path']}"
|
||||
|
|
Loading…
Reference in New Issue