snikket_ynh/scripts/_common.sh
NorbiPeti 008a113068 Fix reachability & prepare
- Added placeholder Nginx configs for the subdomains
- Added additional URLs to the SSO permissions
2024-05-28 00:00:22 +02:00

46 lines
1.6 KiB
Bash

#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
if [[ $(lsb_release --codename --short) == "bookworm" ]]; then
luaversion="5.4"
else
luaversion="5.2"
fi
#=================================================
# PERSONAL HELPERS
#=================================================
install_certificates() {
domains=("$domain" "groups.$domain" "share.$domain")
for d in "${domains[@]}"
do
error_message="No certificate found for domain $d! Please set up the domain and install a Let's Encrypt certificate for it."
cp "/etc/yunohost/certs/$d/crt.pem" "/etc/snikket/certs/${d}.crt" || ynh_print_warn --message="$error_message"
cp "/etc/yunohost/certs/$d/key.pem" "/etc/snikket/certs/${d}.key" || ynh_print_warn --message="$error_message"
done
chown $app /etc/snikket/certs/*
}
### Add Nginx configuration for other domains. This is necessary because at the moment Snikket requires two additional
### subdomains to function fully. Does not reload Nginx configuration.
### Usage: add_extra_nginx_config <domain>
add_extra_nginx_config() {
local extra_domain="$1"
local finalnginxconf="/etc/nginx/conf.d/$extra_domain.d/$app.conf"
ynh_add_config --template="nginx.$extra_domain.conf" --destination="$finalnginxconf"
ynh_store_file_checksum --file="$finalnginxconf"
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================