#!/bin/bash #================================================= # GENERIC STARTING #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS #================================================= encryption_allowed=$(ynh_app_setting_get --app=$app --key=encryption_allowed) #================================================= # SPECIFIC GETTERS FOR TOML SHORT KEY #================================================= get__encryption_allowed() { # Maintenance mode status if [ $encryption_allowed -eq "1" ] then echo "1" else echo "0" fi } #================================================= # SPECIFIC VALIDATORS FOR TOML SHORT KEYS #================================================= #================================================= # SPECIFIC SETTERS FOR TOML SHORT KEYS #================================================= set__encryption_allowed() { if [ "$encryption_allowed" -eq "1" ]; then # If encryption_allowed was set to 1, enable maintenance mode (cd "$final_path" && ynh_exec_as "$app" \ echo "Site under maintenance." > .maintenance) ynh_print_info "Maintenance mode disabled" elif [ "$encryption_allowed" -eq "0" ]; then # If encryption_allowed was set to 0, disable maintenance mode ynh_secure_remove --file=$final_path/.maintenance ynh_print_info "Maintenance mode enabled" fi ynh_app_setting_set --app=$app --key=encryption_allowed --value="$encryption_allowed" } #================================================= # GENERIC FINALIZATION #================================================= ynh_app_config_apply() { _ynh_app_config_apply } ynh_app_config_ run $1