diff --git a/conf/app.ini b/conf/app.ini index 5a08d74..7e6a99a 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -162,9 +162,9 @@ DSA = 1024 ; Either "mysql", "postgres" or "sqlite3", you can connect to TiDB with MySQL protocol DB_TYPE = mysql HOST = 127.0.0.1:3306 -NAME = __DB_USER__ -USER = __DB_USER__ -PASSWD = __DB_PASSWORD__ +NAME = __DB_NAME__ +USER = __DB_NAME__ +PASSWD = __DB_PWD__ ; For "postgres" only, either "disable", "require" or "verify-full" SSL_MODE = disable ; For "sqlite3" and "tidb", use absolute path when you start as service diff --git a/scripts/_common.sh b/scripts/_common.sh index cbb0fd4..624dae9 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -34,10 +34,8 @@ create_dir() { config_gogs() { ynh_backup_if_checksum_is_different "$final_path/custom/conf/app.ini" - ynh_backup_if_checksum_is_different "$final_path/custom/conf/auth.d/ldap.conf" cp ../conf/app.ini "$final_path/custom/conf" - cp ../conf/ldap.conf "$final_path/custom/conf/auth.d/ldap.conf" if [ "$path_url" = "/" ] then @@ -47,8 +45,8 @@ config_gogs() { fi ynh_replace_string "__REPOS_PATH__" "$REPO_PATH" "$final_path/custom/conf/app.ini" - ynh_replace_string "__DB_PASSWORD__" "$dbpass" "$final_path/custom/conf/app.ini" - ynh_replace_string "__DB_USER__" "$dbuser" "$final_path/custom/conf/app.ini" + ynh_replace_string "__DB_PWD__" "$dbpass" "$final_path/custom/conf/app.ini" + ynh_replace_string "__DB_NAME__" "$dbuser" "$final_path/custom/conf/app.ini" ynh_replace_string "__DOMAIN__" "$domain" "$final_path/custom/conf/app.ini" ynh_replace_string "__KEY__" "$key" "$final_path/custom/conf/app.ini" ynh_replace_string "__DATA_PATH__" "$DATA_PATH" "$final_path/custom/conf/app.ini" @@ -62,10 +60,9 @@ config_gogs() { ynh_replace_string "__PRIVATE_MODE__" "true" "$final_path/custom/conf/app.ini" fi - ynh_replace_string "__ADMIN__" "$admin" "$final_path/custom/conf/auth.d/ldap.conf" + ynh_add_config --template="../conf/ldap.conf" --destination="$final_path/custom/conf/auth.d/ldap.conf" ynh_store_file_checksum "$final_path/custom/conf/app.ini" - ynh_store_file_checksum "$final_path/custom/conf/auth.d/ldap.conf" } set_permission() { diff --git a/scripts/install b/scripts/install index f6efc51..6cabfed 100644 --- a/scripts/install +++ b/scripts/install @@ -124,7 +124,6 @@ mkdir -p "/var/log/$app" #================================================= cp ../conf/app.ini "$final_path/custom/conf" -cp ../conf/ldap.conf "$final_path/custom/conf/auth.d/ldap.conf" if [ "$path_url" = "/" ] then @@ -134,8 +133,8 @@ else fi ynh_replace_string --match_string="__REPOS_PATH__" --replace_string="$REPO_PATH" --target_file="$final_path/custom/conf/app.ini" -ynh_replace_string --match_string="__DB_PASSWORD__" --replace_string="$db_pwd" --target_file="$final_path/custom/conf/app.ini" -ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/custom/conf/app.ini" +ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/custom/conf/app.ini" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_user" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__KEY__" --replace_string="$(ynh_string_random)" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__DATA_PATH__" --replace_string="$DATA_PATH" --target_file="$final_path/custom/conf/app.ini" @@ -149,10 +148,9 @@ else ynh_replace_string --match_string="__PRIVATE_MODE__" --replace_string="true" --target_file="$final_path/custom/conf/app.ini" fi -ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/custom/conf/auth.d/ldap.conf" +ynh_add_config --template="../conf/ldap.conf" --destination="$final_path/custom/conf/auth.d/ldap.conf" ynh_store_file_checksum --file="$final_path/custom/conf/app.ini" -ynh_store_file_checksum --file="$final_path/custom/conf/auth.d/ldap.conf" # Configure init script ynh_add_systemd_config diff --git a/scripts/upgrade b/scripts/upgrade index d3d3b99..32c4383 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -77,10 +77,8 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_setup_source --dest_dir=$final_path --source_id="$architecture" ynh_backup_if_checksum_is_different "$final_path/custom/conf/app.ini" -ynh_backup_if_checksum_is_different "$final_path/custom/conf/auth.d/ldap.conf" cp ../conf/app.ini "$final_path/custom/conf" -cp ../conf/ldap.conf "$final_path/custom/conf/auth.d/ldap.conf" if [ "$path_url" = "/" ] then @@ -90,8 +88,8 @@ else fi ynh_replace_string --match_string="__REPOS_PATH__" --replace_string="$REPO_PATH" --target_file="$final_path/custom/conf/app.ini" -ynh_replace_string --match_string="__DB_PASSWORD__" --replace_string="$db_pwd" --target_file="$final_path/custom/conf/app.ini" -ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/custom/conf/app.ini" +ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/custom/conf/app.ini" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_user" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__KEY__" --replace_string="$(ynh_string_random)" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__DATA_PATH__" --replace_string="$DATA_PATH" --target_file="$final_path/custom/conf/app.ini" @@ -105,10 +103,10 @@ else ynh_replace_string --match_string="__PRIVATE_MODE__" --replace_string="true" --target_file="$final_path/custom/conf/app.ini" fi -ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/custom/conf/auth.d/ldap.conf" + +ynh_add_config --template="../conf/ldap.conf" --destination="$final_path/custom/conf/auth.d/ldap.conf" ynh_store_file_checksum "$final_path/custom/conf/app.ini" -ynh_store_file_checksum "$final_path/custom/conf/auth.d/ldap.conf" #================================================= # SETUP SYSTEMD