1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kimai2_ynh.git synced 2024-09-03 19:26:26 +02:00

Add config panel

This commit is contained in:
ericgaspar 2022-03-12 17:40:48 +01:00
parent c461124eda
commit 7d8ce27e3d
No known key found for this signature in database
GPG key ID: 574F281483054D44
3 changed files with 24 additions and 9 deletions

15
config_panel.toml Normal file
View file

@ -0,0 +1,15 @@
version = "1.0"
[main]
name = "Kimai2 configuration"
[main.config]
name = "Configuration Options"
[main.config.registration]
ask = "Enable registration"
type = "boolean"
yes = "true"
no = "false"
help = "Allow Kimai account creation"
bind = "registration:__FINALPATH__/config/packages/local.yaml"

View file

@ -135,8 +135,7 @@ setfacl -R -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/"
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." ynh_script_progression --message="Adding a configuration file..."
if [ $registration -eq 1 ] if [ $registration -eq 1 ]; then
then
registration="true" registration="true"
else else
registration="false" registration="false"
@ -158,14 +157,10 @@ chown $app:$app "$final_path/.env"
#================================================= #=================================================
ynh_script_progression --message="Installing Kimai2..." ynh_script_progression --message="Installing Kimai2..."
#update-alternatives --set php /usr/bin/php$phpversion
pushd "$final_path" pushd "$final_path"
ynh_exec_as $app php$phpversion bin/console kimai:install -n ynh_exec_as $app php$phpversion bin/console kimai:install -n
popd popd
#update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -23,9 +23,10 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
registration=$(ynh_app_setting_get --app=$app --key=registration)
random_key=$(ynh_app_setting_get --app=$app --key=random_key) random_key=$(ynh_app_setting_get --app=$app --key=random_key)
registration=$(ynh_app_setting_get --app=$app --key=registration)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
@ -59,6 +60,11 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi fi
if [ -z "$registration" ]; then
registration_enabled="false"
ynh_app_setting_set --app=$app --key=registration --value=$registration
fi
# Cleaning legacy permissions # Cleaning legacy permissions
if ynh_legacy_permissions_exists; then if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all ynh_legacy_permissions_delete_all
@ -132,8 +138,7 @@ ynh_add_fpm_config
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." ynh_script_progression --message="Adding a configuration file..."
if [ $registration -eq 1 ] if [ $registration -eq 1 ]; then
then
registration="true" registration="true"
else else
registration="false" registration="false"