2019-11-19 13:09:31 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# COMMON VARIABLES
|
|
|
|
#=================================================
|
|
|
|
|
2023-12-11 12:37:28 +01:00
|
|
|
|
2019-11-19 13:09:31 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# PERSONAL HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2023-12-11 12:37:28 +01:00
|
|
|
_yunomonitor_add_nginx_config() {
|
|
|
|
# Create a dedicated nginx config
|
|
|
|
# Note: i don't use the helper because i need this file to be named "000-"
|
|
|
|
finalnginxconf="/etc/nginx/conf.d/$domain.d/000-$app.conf"
|
|
|
|
ynh_backup_if_checksum_is_different --file="$finalnginxconf"
|
|
|
|
cp ../conf/nginx.conf "$finalnginxconf"
|
|
|
|
ynh_replace_string --match_string="__INSTALL_DIR__" --replace_string="$install_dir" --target_file="$finalnginxconf"
|
|
|
|
ynh_store_file_checksum --file="$finalnginxconf"
|
|
|
|
}
|
|
|
|
|
|
|
|
_yunomonitor_remove_nginx_config() {
|
|
|
|
finalnginxconf="/etc/nginx/conf.d/$domain.d/000-$app.conf"
|
|
|
|
ynh_secure_remove --file="$finalnginxconf"
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
}
|
|
|
|
|
2019-11-19 13:09:31 +01:00
|
|
|
#=================================================
|
|
|
|
# EXPERIMENTAL HELPERS
|
|
|
|
#=================================================
|
2022-01-27 02:21:23 +01:00
|
|
|
|
2019-11-19 13:09:31 +01:00
|
|
|
ynh_export () {
|
|
|
|
local ynh_arg=""
|
|
|
|
for var in $@;
|
|
|
|
do
|
|
|
|
ynh_arg=$(echo $var | awk '{print toupper($0)}')
|
2023-12-11 12:37:28 +01:00
|
|
|
if [ "$var" == "path" ]; then
|
2019-11-19 13:09:31 +01:00
|
|
|
ynh_arg="PATH"
|
|
|
|
fi
|
|
|
|
ynh_arg="YNH_APP_ARG_$ynh_arg"
|
|
|
|
export $var="${!ynh_arg}"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# FUTURE OFFICIAL HELPERS
|
|
|
|
#=================================================
|