2023-08-28 18:25:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
. driglibash-base
|
|
|
|
|
|
|
|
JC_ENV=/etc/jeancloud.env
|
|
|
|
|
2023-10-16 08:47:35 +00:00
|
|
|
dns_certs_path=/data/dnscerts.jean-cloud.org/certs/live
|
|
|
|
http_certs_path=/etc/letsencrypt/live
|
2023-08-28 18:25:32 +00:00
|
|
|
proxy_dir=/etc/nginx
|
|
|
|
|
|
|
|
cat > "$JC_ENV" <<EOF
|
|
|
|
proxy_dir='$proxy_dir'
|
2023-10-16 08:47:35 +00:00
|
|
|
nginx_conf_path='$proxy_dir/sites-enabled/'
|
2023-08-28 18:25:32 +00:00
|
|
|
new_nginx_conf_path='$proxy_dir/new-sites-enabled'
|
2023-10-16 08:47:35 +00:00
|
|
|
dns_certs_path='$dns_certs_path'
|
|
|
|
http_certs_path='$http_certs_path'
|
|
|
|
dummy_cert_path='$http_certs_path/dummy'
|
2023-09-15 08:57:47 +00:00
|
|
|
servicefile=/docker/services.txt
|
2023-08-28 18:25:32 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
for dir in /docker/* ; do
|
|
|
|
service="$(basename "$dir")"
|
|
|
|
[ ! -d "$dir" ] && continue
|
|
|
|
|
|
|
|
line_in_file "HTTP_DIR='/srv/http/$service'" "/docker/$service/.env"
|
|
|
|
line_in_file "DATA_DIR='/data/$service'" "/docker/$service/.env"
|
2023-10-31 15:42:06 +00:00
|
|
|
line_in_file "SECRET_DIR='/data/secrets/$service'" "/docker/$service/.env"
|
2023-08-28 18:25:32 +00:00
|
|
|
line_in_file "DOCKER_DIR='/docker/$service'" "/docker/$service/.env"
|
|
|
|
line_in_file "JC_SERVICE='$service'" "/docker/$service/.env"
|
2023-10-31 15:42:06 +00:00
|
|
|
cert="$(findcert.sh "$service")" || true
|
|
|
|
if [ -n "$cert" ] ; then
|
|
|
|
line_in_file "JC_CERT='$cert'" "/docker/$service/.env"
|
|
|
|
fi
|
|
|
|
|
2023-08-28 18:25:32 +00:00
|
|
|
done
|