mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-09 23:20:27 +00:00
Merge branch 'master' of github.com:ngoduykhanh/PowerDNS-Admin
This commit is contained in:
commit
10d915ef92
1
.env
1
.env
@ -4,6 +4,7 @@ PDA_DB_HOST=powerdns-admin-mysql
|
|||||||
PDA_DB_NAME=powerdns_admin
|
PDA_DB_NAME=powerdns_admin
|
||||||
PDA_DB_USER=powerdns_admin
|
PDA_DB_USER=powerdns_admin
|
||||||
PDA_DB_PASSWORD=changeme
|
PDA_DB_PASSWORD=changeme
|
||||||
|
PDA_DB_PORT=3306
|
||||||
|
|
||||||
PDNS_DB_HOST=pdns-mysql
|
PDNS_DB_HOST=pdns-mysql
|
||||||
PDNS_DB_NAME=pdns
|
PDNS_DB_NAME=pdns
|
||||||
|
@ -90,7 +90,7 @@ class User(db.Model):
|
|||||||
|
|
||||||
def verify_totp(self, token):
|
def verify_totp(self, token):
|
||||||
totp = pyotp.TOTP(self.otp_secret)
|
totp = pyotp.TOTP(self.otp_secret)
|
||||||
return totp.verify(int(token))
|
return totp.verify(token)
|
||||||
|
|
||||||
def get_hashed_password(self, plain_text_password=None):
|
def get_hashed_password(self, plain_text_password=None):
|
||||||
# Hash a password for the first time
|
# Hash a password for the first time
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% set active_page = "admin_users" %}
|
{% set active_page = "admin_users" %}
|
||||||
{% block title %}<title>Edit Use - {{ SITE_NAME }}</title>{% endblock %}
|
{% block title %}<title>Edit User - {{ SITE_NAME }}</title>{% endblock %}
|
||||||
|
|
||||||
{% block dashboard_stat %}
|
{% block dashboard_stat %}
|
||||||
<!-- Content Header (Page header) -->
|
<!-- Content Header (Page header) -->
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
<div class="col-xs-8">
|
<div class="col-xs-8">
|
||||||
<div class="checkbox icheck">
|
<div class="checkbox icheck">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox"> Remember Me
|
<input type="checkbox" name="remember"> Remember Me
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,11 +21,12 @@ UPLOAD_DIR = os.path.join(basedir, 'upload')
|
|||||||
SQLA_DB_USER = 'pda'
|
SQLA_DB_USER = 'pda'
|
||||||
SQLA_DB_PASSWORD = 'changeme'
|
SQLA_DB_PASSWORD = 'changeme'
|
||||||
SQLA_DB_HOST = '127.0.0.1'
|
SQLA_DB_HOST = '127.0.0.1'
|
||||||
|
SQLA_DB_PORT = 3306
|
||||||
SQLA_DB_NAME = 'pda'
|
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://'+SQLA_DB_USER+':'+SQLA_DB_PASSWORD+'@'+SQLA_DB_HOST+':'+str(SQLA_DB_PORT)+'/'+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')
|
||||||
|
@ -14,12 +14,12 @@ UPLOAD_DIR = os.path.join(basedir, 'upload')
|
|||||||
|
|
||||||
# DATABASE CONFIG FOR MYSQL
|
# DATABASE CONFIG FOR MYSQL
|
||||||
DB_HOST = os.environ.get('PDA_DB_HOST')
|
DB_HOST = os.environ.get('PDA_DB_HOST')
|
||||||
|
DB_PORT = os.environ.get('PDA_DB_PORT', 3306 )
|
||||||
DB_NAME = os.environ.get('PDA_DB_NAME')
|
DB_NAME = os.environ.get('PDA_DB_NAME')
|
||||||
DB_USER = os.environ.get('PDA_DB_USER')
|
DB_USER = os.environ.get('PDA_DB_USER')
|
||||||
DB_PASSWORD = os.environ.get('PDA_DB_PASSWORD')
|
DB_PASSWORD = os.environ.get('PDA_DB_PASSWORD')
|
||||||
|
|
||||||
#MySQL
|
#MySQL
|
||||||
SQLALCHEMY_DATABASE_URI = 'mysql://'+DB_USER+':'+DB_PASSWORD+'@'+DB_HOST+'/'+DB_NAME
|
SQLALCHEMY_DATABASE_URI = 'mysql://'+DB_USER+':'+DB_PASSWORD+'@'+DB_HOST+':'+ str(DB_PORT) + '/'+DB_NAME
|
||||||
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
|
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
|
||||||
SQLALCHEMY_TRACK_MODIFICATIONS = True
|
SQLALCHEMY_TRACK_MODIFICATIONS = True
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ services:
|
|||||||
- PDA_DB_NAME=${PDA_DB_NAME}
|
- PDA_DB_NAME=${PDA_DB_NAME}
|
||||||
- PDA_DB_USER=${PDA_DB_USER}
|
- PDA_DB_USER=${PDA_DB_USER}
|
||||||
- PDA_DB_PASSWORD=${PDA_DB_PASSWORD}
|
- PDA_DB_PASSWORD=${PDA_DB_PASSWORD}
|
||||||
|
- PDA_DB_PORT=${PDA_DB_PORT}
|
||||||
- PDNS_HOST=${PDNS_HOST}
|
- PDNS_HOST=${PDNS_HOST}
|
||||||
- PDNS_API_KEY=${PDNS_API_KEY}
|
- PDNS_API_KEY=${PDNS_API_KEY}
|
||||||
- FLASK_APP=/powerdns-admin/app/__init__.py
|
- FLASK_APP=/powerdns-admin/app/__init__.py
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -o nounset
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
@ -8,13 +7,21 @@ set -o pipefail
|
|||||||
# == Vars
|
# == Vars
|
||||||
#
|
#
|
||||||
DB_MIGRATION_DIR='/powerdns-admin/migrations'
|
DB_MIGRATION_DIR='/powerdns-admin/migrations'
|
||||||
|
if [[ -z ${PDNS_PROTO} ]];
|
||||||
|
then PDNS_PROTO="http"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z ${PDNS_PORT} ]];
|
||||||
|
then PDNS_PORT=8081
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Wait for us to be able to connect to MySQL before proceeding
|
# Wait for us to be able to connect to MySQL before proceeding
|
||||||
echo "===> Waiting for $PDA_DB_HOST MySQL service"
|
echo "===> Waiting for $PDA_DB_HOST MySQL service"
|
||||||
until nc -zv \
|
until nc -zv \
|
||||||
$PDA_DB_HOST \
|
$PDA_DB_HOST \
|
||||||
3306;
|
$PDA_DB_PORT;
|
||||||
do
|
do
|
||||||
echo "MySQL ($PDA_DB_HOST) is unavailable - sleeping"
|
echo "MySQL ($PDA_DB_HOST) is unavailable - sleeping"
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -42,12 +49,12 @@ fi
|
|||||||
|
|
||||||
echo "===> Update PDNS API connection info"
|
echo "===> Update PDNS API connection info"
|
||||||
# initial setting if not available in the DB
|
# initial setting if not available in the DB
|
||||||
mysql -h${PDA_DB_HOST} -u${PDA_DB_USER} -p${PDA_DB_PASSWORD} ${PDA_DB_NAME} -e "INSERT INTO setting (name, value) SELECT * FROM (SELECT 'pdns_api_url', 'http://${PDNS_HOST}:8081') AS tmp WHERE NOT EXISTS (SELECT name FROM setting WHERE name = 'pdns_api_url') LIMIT 1;"
|
mysql -h${PDA_DB_HOST} -u${PDA_DB_USER} -p${PDA_DB_PASSWORD} -P${PDA_DB_PORT} ${PDA_DB_NAME} -e "INSERT INTO setting (name, value) SELECT * FROM (SELECT 'pdns_api_url', '${PDNS_PROTO}://${PDNS_HOST}:${PDNS_PORT}') AS tmp WHERE NOT EXISTS (SELECT name FROM setting WHERE name = 'pdns_api_url') LIMIT 1;"
|
||||||
mysql -h${PDA_DB_HOST} -u${PDA_DB_USER} -p${PDA_DB_PASSWORD} ${PDA_DB_NAME} -e "INSERT INTO setting (name, value) SELECT * FROM (SELECT 'pdns_api_key', '${PDNS_API_KEY}') AS tmp WHERE NOT EXISTS (SELECT name FROM setting WHERE name = 'pdns_api_key') LIMIT 1;"
|
mysql -h${PDA_DB_HOST} -u${PDA_DB_USER} -p${PDA_DB_PASSWORD} -P${PDA_DB_PORT} ${PDA_DB_NAME} -e "INSERT INTO setting (name, value) SELECT * FROM (SELECT 'pdns_api_key', '${PDNS_API_KEY}') AS tmp WHERE NOT EXISTS (SELECT name FROM setting WHERE name = 'pdns_api_key') LIMIT 1;"
|
||||||
|
|
||||||
# update pdns api setting if .env is changed.
|
# update pdns api setting if .env is changed.
|
||||||
mysql -h${PDA_DB_HOST} -u${PDA_DB_USER} -p${PDA_DB_PASSWORD} ${PDA_DB_NAME} -e "UPDATE setting SET value='http://${PDNS_HOST}:8081' WHERE name='pdns_api_url';"
|
mysql -h${PDA_DB_HOST} -u${PDA_DB_USER} -p${PDA_DB_PASSWORD} -P${PDA_DB_PORT} ${PDA_DB_NAME} -e "UPDATE setting SET value='${PDNS_PROTO}://${PDNS_HOST}:${PDNS_PORT}' WHERE name='pdns_api_url';"
|
||||||
mysql -h${PDA_DB_HOST} -u${PDA_DB_USER} -p${PDA_DB_PASSWORD} ${PDA_DB_NAME} -e "UPDATE setting SET value='${PDNS_API_KEY}' WHERE name='pdns_api_key';"
|
mysql -h${PDA_DB_HOST} -u${PDA_DB_USER} -p${PDA_DB_PASSWORD} -P${PDA_DB_PORT} ${PDA_DB_NAME} -e "UPDATE setting SET value='${PDNS_API_KEY}' WHERE name='pdns_api_key';"
|
||||||
|
|
||||||
echo "===> Assets management"
|
echo "===> Assets management"
|
||||||
echo "---> Running Yarn"
|
echo "---> Running Yarn"
|
||||||
|
Loading…
Reference in New Issue
Block a user