From ffbef9123efdaf83dd77a1da6ba73c0e3c2e535f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 18 Jan 2022 15:09:10 +0100 Subject: [PATCH] Fix --- conf/miniflux.conf | 2 +- config_panel.toml | 25 +++++++++++++++++++++++++ scripts/install | 3 +++ scripts/upgrade | 6 ++++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 config_panel.toml diff --git a/conf/miniflux.conf b/conf/miniflux.conf index aefe59c..8aa7c2e 100644 --- a/conf/miniflux.conf +++ b/conf/miniflux.conf @@ -2,6 +2,6 @@ BASE_URL=https://__DOMAIN____PATH__ LISTEN_ADDR=127.0.0.1:__PORT__ DATABASE_URL=postgres://__DB_NAME__:__DB_PWD__@localhost/__DB_NAME__?sslmode=disable RUN_MIGRATIONS=1 -CREATE_ADMIN=1 +CREATE_ADMIN=__SET_ADMIN__ ADMIN_USERNAME=__ADMIN__ ADMIN_PASSWORD=__PASSWORD__ \ No newline at end of file diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..7685434 --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,25 @@ +version = "1.0" + +[main] +name = "Miniflux configuration" + + [main.config] + name = "Configuration Options" + + [main.config.set_admin] + ask = "Allow admin" + type = "boolean" + help = "Enable authentication with user/password." + bind = "CREATE_ADMIN:__FINALPATH__/__APP__.conf" + + [main.config.admin] + ask = "Set admin" + type = "user" + help = "enter the name of the admin." + bind = "ADMIN_USERNAME:__FINALPATH__/__APP__.conf" + + [main.config.password] + ask = "Set password" + type = "password" + help = "Specify password." + bind = "password:__FINALPATH__/__APP__.conf" diff --git a/scripts/install b/scripts/install index 3e98d1d..d98f465 100644 --- a/scripts/install +++ b/scripts/install @@ -29,6 +29,8 @@ admin=$YNH_APP_ARG_ADMIN app=$YNH_APP_INSTANCE_NAME +set_admin="1" + #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -50,6 +52,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=password --value=$password ynh_app_setting_set --app=$app --key=architecture --value=$architecture +ynh_app_setting_set --app=$app --key=set_admin --value=$set_admin #================================================= # STANDARD MODIFICATIONS diff --git a/scripts/upgrade b/scripts/upgrade index 8fe5a72..d1ef0cb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,6 +24,7 @@ architecture=$YNH_ARCH db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +set_admin=$(ynh_app_setting_get --app=$app --key=set_admin) #================================================= # CHECK VERSION @@ -51,6 +52,11 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +if [ -z "$set_admin" ]; then + set_admin="1" + ynh_app_setting_set --app=$app --key=set_admin --value=$set_admin +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all