From 62bc097eb8e714004ccc09a0a04c353a5b58ff31 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 25 Sep 2020 11:04:26 +0200 Subject: [PATCH] fix --- conf/config.php | 3 +-- scripts/install | 27 +++++++++------------------ scripts/upgrade | 10 ---------- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/conf/config.php b/conf/config.php index 8009042..ff41004 100644 --- a/conf/config.php +++ b/conf/config.php @@ -51,7 +51,7 @@ define( 'YOURLS_UNIQUE_URLS', true ); define( 'YOURLS_PRIVATE', false ); /** A random secret hash used to encrypt cookies. You don't have to remember it, make it long and complicated. Hint: copy from http://yourls.org/cookie **/ -define( 'YOURLS_COOKIEKEY', 'modify this text with something random' ); +define( 'YOURLS_COOKIEKEY', '__RANDOM__' ); /** Username(s) and password(s) allowed to access the site. Passwords either in plain text or as encrypted hashes ** YOURLS will auto encrypt plain text passwords in this file @@ -91,4 +91,3 @@ $yourls_reserved_URL = array( //define( 'LDAPAUTH_PORT', '389' ); //define( 'LDAPAUTH_BASE', 'dc=yunohost,dc=org' ); //define( 'LDAPAUTH_USERNAME_FIELD', 'uid'); - diff --git a/scripts/install b/scripts/install index ba8c290..01275f7 100644 --- a/scripts/install +++ b/scripts/install @@ -80,16 +80,8 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 +ynh_script_progression --message="Configuring NGINX web server..." --time --weight=1 -### `ynh_add_nginx_config` will use the file conf/nginx.conf - -# Create a dedicated nginx config -if [ "$path_url" != "/" ]; then - ynh_replace_string --match_string="__PATHTOCHANGE__" --replace_string="$path_url" --target_file="../conf/nginx.conf" -else - ynh_replace_string --match_string="__PATHTOCHANGE__" --replace_string=" " --target_file="../conf/nginx.conf" -fi ynh_add_nginx_config #================================================= @@ -103,7 +95,7 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --time --weight=1 +ynh_script_progression --message="Configuring PHP-FPM..." --time --weight=1 # Create a dedicated php-fpm config ynh_add_fpm_config @@ -114,15 +106,14 @@ sudo cp ../conf/index.php $final_path/ #================================================= # MODIFY A CONFIG FILE #================================================= -### `ynh_replace_string` is used to replace a string in a file. -### (It's compatible with sed regular expressions syntax) + sudo cp ../conf/config.php $final_path/user/config.php -ynh_replace_string --match_string="yunouser" --replace_string="$db_name" --target_file="$final_path/user/config.php" -ynh_replace_string --match_string="yunopass" --replace_string="$db_pwd" --target_file="$final_path/user/config.php" -ynh_replace_string --match_string="yunobase" --replace_string="$db_name" --target_file="$final_path/user/config.php" -ynh_replace_string --match_string="yunodomain" --replace_string="$domain" --target_file="$final_path/user/config.php" -ynh_replace_string --match_string="_yourlspath" --replace_string="${path_url%/}" --target_file="$final_path/user/config.php" -ynh_replace_string --match_string="modify this text with something random" --replace_string="$(ynh_string_random 24)$(ynh_string_random 24)" --target_file="$final_path/user/config.php" + +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/user/config.php" +ynh_replace_string --match_string="__DB_PASSWORD__" --replace_string="$db_pwd" --target_file="$final_path/user/config.php" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/user/config.php" +ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$final_path/user/config.php" +ynh_replace_string --match_string="__RANDOM__" --replace_string="$(ynh_string_random 24)" --target_file="$final_path/user/config.php" # The script "add_sso_conf.py" will just add en entry for the path "/admin" in the sso conf.json.persistent file in the cathegory "protected_urls". cp ../conf/add_sso_conf.py $final_path/add_sso_conf.py diff --git a/scripts/upgrade b/scripts/upgrade index ed7b785..7b194a2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,8 +21,6 @@ admin=$(ynh_app_setting_get --app=$app --key=admin) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) - - #================================================= # CHECK VERSION #================================================= @@ -105,14 +103,6 @@ rm -Rf "$tmpdir" #================================================= ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1 -# Create a dedicated nginx config -if [ "$path_url" != "/" ]; then - ynh_replace_string --match_string="__PATHTOCHANGE__" --replace_string="$path_url" --target_file="../conf/nginx.conf" -else - ynh_replace_string --match_string="__PATHTOCHANGE__" --replace_string=" " --target_file="../conf/nginx.conf" -fi - -# Create a dedicated nginx config ynh_add_nginx_config #=================================================