elasticsearch7_ynh/scripts/config

67 lines
2 KiB
Text
Raw Permalink Normal View History

2022-11-26 19:48:19 +01:00
#!/bin/bash
# In simple cases, you don't need a config script.
2022-11-26 19:48:19 +01:00
# With a simple config_panel.toml, you can write in the app settings, in the
2022-11-26 19:48:19 +01:00
# upstream config file or replace complete files (logo ...) and restart services.
# The config scripts allows you to go further, to handle specific cases
2022-11-26 19:48:19 +01:00
# (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
2022-11-26 19:48:19 +01:00
}
get__xmx() {
ynh_app_setting_get --app=$app --key=xmx
2022-11-26 19:48:19 +01:00
}
#=================================================
# 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
2022-11-26 19:48:19 +01:00
}
#=================================================
# GENERIC FINALIZATION
#=================================================
ynh_app_config_run $1