From 3d25d5a0d40d5879d528da6c8f49b35ad46961d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 15 Mar 2024 13:21:59 +0100 Subject: [PATCH] Use ynh_add_config for parameters.yml instead of modifying the source file --- conf/parameters.yml | 69 +++++++++++++++++++++++++++++++++++++++++++++ scripts/install | 14 ++------- scripts/upgrade | 13 ++------- 3 files changed, 73 insertions(+), 23 deletions(-) create mode 100644 conf/parameters.yml diff --git a/conf/parameters.yml b/conf/parameters.yml new file mode 100644 index 0000000..5b5f803 --- /dev/null +++ b/conf/parameters.yml @@ -0,0 +1,69 @@ +# This file is a "template" of what your parameters.yml file should look like +parameters: + # Uncomment these settings or manually update your parameters.yml + # to use docker-compose + # + # database_driver: %env.database_driver% + # database_host: %env.database_host% + # database_port: %env.database_port% + # database_name: %env.database_name% + # database_user: %env.database_user% + # database_password: %env.database_password% + + database_driver: pdo_mysql + database_host: 127.0.0.1 + database_port: ~ + database_name: __DB_NAME__ + database_user: __DB_USER__ + database_password: __DB_PWD__ + # For SQLite, database_path should be "%kernel.project_dir%/data/db/wallabag.sqlite" + database_path: null + database_table_prefix: null + database_socket: null + # with PostgreSQL and SQLite, you must set "utf8" + database_charset: utf8mb4 + + domain_name: https://__DOMAIN____PATH__ + server_name: "Your wallabag instance" + + #mailer_dsn: smtp://user:pass@__DOMAIN__:25 + mailer_dsn: sendmail://default + + locale: en + + # A secret key that's used to generate certain security-related tokens + secret: __DESKEY__ + + # two factor stuff + twofactor_auth: true + twofactor_sender: no-reply@wallabag.org + + # fosuser stuff + fosuser_registration: false + fosuser_confirmation: true + + # how long the access token should live in seconds for the API + fos_oauth_server_access_token_lifetime: 3600 + # how long the refresh token should life in seconds for the API + fos_oauth_server_refresh_token_lifetime: 1209600 + + from_email: no-reply@wallabag.org + + rss_limit: 50 + + # RabbitMQ processing + rabbitmq_host: localhost + rabbitmq_port: 5672 + rabbitmq_user: guest + rabbitmq_password: guest + rabbitmq_prefetch_count: 10 + + # Redis processing + redis_scheme: tcp + redis_host: localhost + redis_port: 6379 + redis_path: null + redis_password: null + + # sentry logging + sentry_dsn: ~ diff --git a/scripts/install b/scripts/install index 21f3764..c8914fd 100644 --- a/scripts/install +++ b/scripts/install @@ -40,19 +40,9 @@ fi #================================================= ynh_script_progression --message="Adding $app's configuration files..." --weight=1 -# Copy and set Wallabag dist configuration -cp "$install_dir/app/config/parameters.yml.dist" "$wb_conf" - -ynh_replace_string --target_file="$wb_conf" --match_string="fosuser_registration: true" --replace_string="fosuser_registration: false" -ynh_replace_string --target_file="$wb_conf" --match_string="database_name: wallabag" --replace_string="database_name: $db_name" -ynh_replace_string --target_file="$wb_conf" --match_string="database_user: root" --replace_string="database_user: $db_user" -ynh_replace_string --target_file="$wb_conf" --match_string="database_password: ~" --replace_string="database_password: $db_pwd" -ynh_replace_string --target_file="$wb_conf" --match_string="database_table_prefix: wallabag_" --replace_string="database_table_prefix: null" -ynh_replace_string --target_file="$wb_conf" --match_string="secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv" --replace_string="secret: $deskey" -ynh_replace_string --target_file="$wb_conf" --match_string="domain_name: https://your-wallabag-url-instance.com" --replace_string="domain_name: https://$domain$path" - +ynh_add_config --template="parameters.yml" --destination="$wb_conf" chmod 600 "$wb_conf" -chown -R "$app:www-data" "$install_dir" +chown "$app:www-data" "$wb_conf" # Alias for php-cli execution command php_exec=("php$phpversion" "$install_dir/bin/console" --no-interaction --env=prod) diff --git a/scripts/upgrade b/scripts/upgrade index 605472d..5b6cab2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,18 +38,9 @@ fi ynh_script_progression --message="Reconfiguring $app..." --weight=1 # Copy and set Wallabag dist configuration -cp "$install_dir/app/config/parameters.yml.dist" "$wb_conf" - -ynh_replace_string --target_file="$wb_conf" --match_string="fosuser_registration: true" --replace_string="fosuser_registration: false" -ynh_replace_string --target_file="$wb_conf" --match_string="database_name: wallabag" --replace_string="database_name: $db_name" -ynh_replace_string --target_file="$wb_conf" --match_string="database_user: root" --replace_string="database_user: $db_user" -ynh_replace_string --target_file="$wb_conf" --match_string="database_password: ~" --replace_string="database_password: $db_pwd" -ynh_replace_string --target_file="$wb_conf" --match_string="database_table_prefix: wallabag_" --replace_string="database_table_prefix: null" -ynh_replace_string --target_file="$wb_conf" --match_string="secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv" --replace_string="secret: $deskey" -ynh_replace_string --target_file="$wb_conf" --match_string="domain_name: https://your-wallabag-url-instance.com" --replace_string="domain_name: https://$domain$path" - +ynh_add_config --template="parameters.yml" --destination="$wb_conf" chmod 600 "$wb_conf" -chown -R "$app:www-data" "$install_dir" +chown "$app:www-data" "$wb_conf" # Alias for php-cli execution command php_exec=("php$phpversion" "$install_dir/bin/console" --no-interaction --env=prod)