Create initial domain record in start.sh if fqdn was provided

This commit is contained in:
Johannes Zellner
2017-11-15 23:22:08 +01:00
parent 635426c37e
commit 321bfc6130
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -41,6 +41,7 @@ while true; do
# these params must be valid in all cases
arg_fqdn=$(echo "$2" | $json fqdn)
arg_zone_name=$(echo "$2" | $json zoneName)
[[ "${arg_zone_name}" == "" ]] && arg_zone_name="${arg_fqdn}"
arg_is_custom_domain=$(echo "$2" | $json isCustomDomain)
[[ "${arg_is_custom_domain}" == "" ]] && arg_is_custom_domain="true"
+4
View File
@@ -245,6 +245,10 @@ EOF
echo "==> Adding automated configs"
mysql -u root -p${mysql_root_password} -e "REPLACE INTO settings (name, value) VALUES (\"domain\", '{ \"fqdn\": \"$arg_fqdn\", \"zoneName\": \"$arg_zone_name\", \"adminLocation\": \"$arg_admin_location\" }')" box
if [[ ! -z "${arg_fqdn}" ]]; then
mysql -u root -p${mysql_root_password} -e "INSERT INTO domains (domain, zoneName, configJson) VALUES ('$arg_fqdn', '$arg_zone_name', '$arg_dns_config')" box || true
fi
if [[ ! -z "${arg_backup_config}" ]]; then
mysql -u root -p${mysql_root_password} \
-e "REPLACE INTO settings (name, value) VALUES (\"backup_config\", '$arg_backup_config')" box