garage_ynh/scripts/config

47 lines
1.2 KiB
Plaintext
Raw Normal View History

2020-11-03 21:28:45 +01:00
#!/bin/bash
2021-09-29 02:41:30 +02:00
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2020-11-03 21:28:45 +01:00
source _common.sh
2021-09-29 02:41:30 +02:00
source /usr/share/yunohost/helpers
2020-11-03 21:28:45 +01:00
2021-09-29 02:41:30 +02:00
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
final_path=$(ynh_app_setting_get $app final_path)
node_id=$(ynh_app_setting_get $app node_id)
command="$final_path/garage -c $final_path/garage.toml"
2021-09-29 02:41:30 +02:00
get_weight() {
ynh_app_setting_get --app=$app --key=weight
2020-11-03 21:28:45 +01:00
}
set_weight() {
$command layout assign $node_id -c $weight
apply_layout "$command"
ynh_app_setting_set --app=$app --key=weight --value=$weight
2020-11-03 21:28:45 +01:00
}
get_peers() {
ynh_app_setting_get --app=$app --key=bootstrap_peers
2020-11-03 21:28:45 +01:00
}
set_peers() {
garage_connect "$command" "$bootstrap_peers"
apply_layout "$command"
ynh_app_setting_set --app=$app --key=bootstrap_peers --value=$bootstrap_peers
2020-11-03 21:28:45 +01:00
}
2020-11-03 21:28:45 +01:00
#=================================================
2021-09-29 02:41:30 +02:00
# GENERIC FINALIZATION
2020-11-03 21:28:45 +01:00
#=================================================
2021-09-29 02:41:30 +02:00
ynh_app_config_run $1