diff --git a/conf/nginx.conf b/conf/nginx.conf index 4aca76b..2521185 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,16 +1,17 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { + + # Force https + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } + proxy_pass http://localhost:__PORT__/; proxy_set_header Host $host; proxy_buffering off; fastcgi_param REMOTE_USER $remote_user; client_max_body_size 200M; - # Force https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } diff --git a/scripts/_common.sh b/scripts/_common.sh index 89ea043..6176b97 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -120,38 +120,4 @@ ynh_check_starting () { local app_log="${2:-/var/log/$service_name/$service_name.log}" local timeout=${3:-300} - ynh_clean_check_starting () { - # Stop the execution of tail. - kill -s 15 $pid_tail 2>&1 - ynh_secure_remove "$templog" 2>&1 - } - - echo "Starting of $service_name" >&2 - systemctl stop $service_name - local templog="$(mktemp)" - # Following the starting of the app in its log - tail -F -n0 "$app_log" > "$templog" & - # Get the PID of the tail command - local pid_tail=$! - systemctl start $service_name - - local i=0 - for i in `seq 1 $timeout` - do - # Read the log until the sentence is found, that means the app finished to start. Or run until the timeout - if grep --quiet "$line_to_match" "$templog" - then - echo "The service $service_name has correctly started." >&2 - break - fi - echo -n "." >&2 - sleep 1 - done - if [ $i -eq $timeout ] - then - echo "The service $service_name didn't fully started before the timeout." >&2 - fi - - echo "" - ynh_clean_check_starting -} + \ No newline at end of file diff --git a/scripts/change_url b/scripts/change_url index 36c742a..b7998fe 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -22,7 +22,7 @@ domain=$YNH_APP_NEW_DOMAIN path_url=$(ynh_normalize_url_path ${YNH_APP_NEW_PATH:-'/'}) app=$YNH_APP_INSTANCE_NAME -dbpass=$(ynh_app_setting_get "$app" mysqlpwd) +db_pwd=$(ynh_app_setting_get "$app" mysqlpwd) admin=$(ynh_app_setting_get "$app" adminusername) key=$(ynh_app_setting_get "$app" secret_key) port=$(ynh_app_setting_get "$app" web_port) diff --git a/scripts/install b/scripts/install index d679a9e..26e6d8c 100644 --- a/scripts/install +++ b/scripts/install @@ -81,9 +81,8 @@ db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) - -dbpass=$(ynh_string_random) #to be changed #================================================= # STANDARD MODIFICATIONS #================================================= @@ -127,8 +126,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="$dbpass" --target_file="$final_path/custom/conf/app.ini" -ynh_replace_string --match_string="__DB_USER__" --replace_string="$dbuser" --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="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__KEY__" --replace_string="$key" --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" diff --git a/scripts/restore b/scripts/restore index 4fd1ad7..5222e54 100644 --- a/scripts/restore +++ b/scripts/restore @@ -30,7 +30,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -dbpass=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) admin=$(ynh_app_setting_get --app=$app --key=adminusername) diff --git a/scripts/upgrade b/scripts/upgrade index 03b953b..75dbcaf 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,7 +21,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get "$app" domain) path_url=$(ynh_normalize_url_path $(ynh_app_setting_get "$app" path)) -dbpass=$(ynh_app_setting_get "$app" mysqlpwd) +db_pwd=$(ynh_app_setting_get "$app" mysqlpwd) admin=$(ynh_app_setting_get "$app" adminusername) key=$(ynh_app_setting_get "$app" secret_key) is_public=$(ynh_app_setting_get "$app" is_public) @@ -87,7 +87,7 @@ fi # Remove old authentification mecanisme, actually the registry in the database has been replaced by a config file if [[ ! -e "$final_path/custom/conf/auth.d/ldap.conf" ]] then - ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" <<< "DELETE FROM login_source WHERE name = 'Yunohost LDAP';" + ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" <<< "DELETE FROM login_source WHERE name = 'Yunohost LDAP';" mkdir -p "$final_path/custom/conf/auth.d" fi