added support for DOMAIN env var insted of file

This commit is contained in:
mrfry 2023-04-11 10:33:52 +02:00
parent 7d1bddd7e2
commit d310895fcb
9 changed files with 53 additions and 29 deletions

View file

@ -38,10 +38,18 @@ makeNextSubmodule() {
checkFile "$PWD/src/server.ts"
checkFile "$PWD/package.json"
checkFile "$PWD/package-lock.json"
if [ ! -f "${domainPath}" ]; then
error "${domainPath} does not exist!"
echo "Please create it, and re-run this script."
echo "Expected content: domain, ex.:'frylabs.net' (without http:// and /)"
domain="${DOMAIN}"
if [ -z "${domain}" ] && [ -f "${domainPath}" ]; then
domain=$(cat "${domainPath}")
fi
if [ -z "${domain}" ]; then
error "DOMAIN is not set, and ${domainPath} does not exist!"
echo "Set DOMAIN to the preferred domain"
echo "Or please create the file ${domainPath}, and re-run this script"
echo "Expected content: domain, ex.:'frylabs.net' (without 'http://' and '/')"
exit 1
fi
@ -113,3 +121,4 @@ fi
# ------------------------------------------------------------------------------------
log "Done! development mode: 'npm run dev', prod mode: 'npm run start', tests: 'npm run test'"
exit 0