elasticsearch7_ynh/scripts/config
2022-11-29 22:40:10 +01:00

66 lines
2 KiB
Bash

#!/bin/bash
# In simple cases, you don't need a config script.
# With a simple config_panel.toml, you can write in the app settings, in the
# upstream config file or replace complete files (logo ...) and restart services.
# The config scripts allows you to go further, to handle specific cases
# (validation of several interdependent fields, specific getter/setter for a value,
# display dynamic informations or choices, pre-loading of config type .cube... ).
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# SPECIFIC GETTERS FOR TOML SHORT KEY
#=================================================
get__xms() {
ynh_app_setting_get --app=$app --key=xms
}
get__xmx() {
ynh_app_setting_get --app=$app --key=xmx
}
#=================================================
# SPECIFIC VALIDATORS FOR TOML SHORT KEYS
#=================================================
#=================================================
# SPECIFIC SETTERS FOR TOML SHORT KEYS
#=================================================
regenerate_jvm_options() {
ynh_add_config --template="jvm.options" --destination="$final_path/config/jvm.options.d/yunohost.options"
chown $app:$app "$final_path/config/jvm.options.d/yunohost.options"
chmod 400 "$final_path/config/jvm.options.d/yunohost.options"
}
set__xms() {
ynh_app_setting_set --app=$app --key=xms --value=$xms
regenerate_jvm_options
}
set__xmx() {
ynh_app_setting_set --app=$app --key=xmx --value=$xmx
regenerate_jvm_options
}
#=================================================
# GENERIC FINALIZATION
#=================================================
ynh_app_config_run $1