mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-09 15:10:27 +00:00
default config: add exemplary URL encoding step for SQLA DB URL params
SQLAlchemy database URLs follow RFC-1738, so parameters like username and password need to be encoded accordingly. https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls
This commit is contained in:
parent
a3b70a8f47
commit
701a442d12
@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
basedir = os.path.abspath(os.path.abspath(os.path.dirname(__file__)))
|
#import urllib.parse
|
||||||
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
### BASIC APP CONFIG
|
### BASIC APP CONFIG
|
||||||
SALT = '$2b$12$yLUMTIfl21FKJQpTkRQXCu'
|
SALT = '$2b$12$yLUMTIfl21FKJQpTkRQXCu'
|
||||||
@ -16,7 +17,12 @@ SQLA_DB_NAME = 'pda'
|
|||||||
SQLALCHEMY_TRACK_MODIFICATIONS = True
|
SQLALCHEMY_TRACK_MODIFICATIONS = True
|
||||||
|
|
||||||
### DATABASE - MySQL
|
### DATABASE - MySQL
|
||||||
# SQLALCHEMY_DATABASE_URI = 'mysql://' + SQLA_DB_USER + ':' + SQLA_DB_PASSWORD + '@' + SQLA_DB_HOST + '/' + SQLA_DB_NAME
|
#SQLALCHEMY_DATABASE_URI = 'mysql://{}:{}@{}/{}'.format(
|
||||||
|
# urllib.parse.quote_plus(SQLA_DB_USER),
|
||||||
|
# urllib.parse.quote_plus(SQLA_DB_PASSWORD),
|
||||||
|
# SQLA_DB_HOST,
|
||||||
|
# SQLA_DB_NAME
|
||||||
|
#)
|
||||||
|
|
||||||
### DATABASE - SQLite
|
### DATABASE - SQLite
|
||||||
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'pdns.db')
|
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'pdns.db')
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
basedir = os.path.abspath(os.path.abspath(os.path.dirname(__file__)))
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
### BASIC APP CONFIG
|
### BASIC APP CONFIG
|
||||||
SALT = '$2b$12$yLUMTIfl21FKJQpTkRQXCu'
|
SALT = '$2b$12$yLUMTIfl21FKJQpTkRQXCu'
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
basedir = os.path.abspath(os.path.abspath(os.path.dirname(__file__)))
|
import urllib.parse
|
||||||
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
### BASIC APP CONFIG
|
### BASIC APP CONFIG
|
||||||
SALT = '$2b$12$yLUMTIfl21FKJQpTkRQXCu'
|
SALT = '$2b$12$yLUMTIfl21FKJQpTkRQXCu'
|
||||||
@ -18,7 +19,12 @@ SQLA_DB_NAME = 'pda'
|
|||||||
SQLALCHEMY_TRACK_MODIFICATIONS = True
|
SQLALCHEMY_TRACK_MODIFICATIONS = True
|
||||||
|
|
||||||
### DATABASE - MySQL
|
### DATABASE - MySQL
|
||||||
SQLALCHEMY_DATABASE_URI = 'mysql://'+SQLA_DB_USER+':'+SQLA_DB_PASSWORD+'@'+SQLA_DB_HOST+'/'+SQLA_DB_NAME
|
SQLALCHEMY_DATABASE_URI = 'mysql://{}:{}@{}/{}'.format(
|
||||||
|
urllib.parse.quote_plus(SQLA_DB_USER),
|
||||||
|
urllib.parse.quote_plus(SQLA_DB_PASSWORD),
|
||||||
|
SQLA_DB_HOST,
|
||||||
|
SQLA_DB_NAME
|
||||||
|
)
|
||||||
|
|
||||||
### DATABASE - SQLite
|
### DATABASE - SQLite
|
||||||
# SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'pdns.db')
|
# SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'pdns.db')
|
||||||
|
Loading…
Reference in New Issue
Block a user