@@ -22,9 +22,43 @@ The script will update existing certificates if they are already configured.
2222Installation path: $INSTALL_DIR
2323EOF
2424
25- [ -z " ${DOMAIN} " ] && { [ " $INTERACTIVE " = " true" ] || { printf ' %s\n' " OPENOPS_DOMAIN is not set" >&2 ; exit 1; }; printf ' Enter your fully qualified domain name: ' ; IFS= read -r DOMAIN < /dev/tty ; }
25+ # Try to fetch existing URL from configuration (only if it's https)
26+ CURRENT_URL=" "
27+ if [ -f " $INSTALL_DIR /.env" ]; then
28+ FULL_URL=$( grep ' ^OPS_PUBLIC_URL=' " $INSTALL_DIR /.env" 2> /dev/null | cut -d= -f2- || true)
29+ case " $FULL_URL " in
30+ https://* )
31+ CURRENT_URL=$( echo " $FULL_URL " | sed ' s|^https://||' )
32+ ;;
33+ esac
34+ fi
35+
36+ if [ -z " ${DOMAIN} " ]; then
37+ if [ " $INTERACTIVE " = " true" ]; then
38+ if [ -n " $CURRENT_URL " ]; then
39+ printf ' Enter your fully qualified domain name [%s]: ' " $CURRENT_URL "
40+ else
41+ printf ' Enter your fully qualified domain name: '
42+ fi
43+ IFS= read -r DOMAIN < /dev/tty
44+ [ -z " $DOMAIN " ] && [ -n " $CURRENT_URL " ] && DOMAIN=" $CURRENT_URL "
45+ else
46+ printf ' %s\n' " OPENOPS_DOMAIN is not set" >&2
47+ exit 1
48+ fi
49+ fi
2650 echo " Fully qualified domain name: $DOMAIN "
27- [ -z " ${EMAIL} " ] && { [ " $INTERACTIVE " = " true" ] || { printf ' %s\n' " OPENOPS_EMAIL is not set" >&2 ; exit 1; }; printf ' Enter your email for certificate related notifications: ' ; IFS= read -r EMAIL < /dev/tty ; }
51+
52+ if [ -z " ${EMAIL} " ]; then
53+ if [ " $INTERACTIVE " = " true" ]; then
54+ printf ' Enter your email for certificate related notifications [noreply@example.com]: '
55+ IFS= read -r EMAIL < /dev/tty
56+ [ -z " $EMAIL " ] && EMAIL=" noreply@example.com"
57+ else
58+ printf ' %s\n' " OPENOPS_EMAIL is not set" >&2
59+ exit 1
60+ fi
61+ fi
2862 echo " Email: $EMAIL "
2963 check_for_user_confirmation
3064
0 commit comments