feat: add SAAS_ADMIN_EMAIL to both installers
Derive admin email from <ADMIN_USER>@<PUBLIC_HOST> by default. Supports override via --admin-email CLI flag, SAAS_ADMIN_EMAIL env var, or admin_email in cameleer.conf. Written to .env for bootstrap.
This commit is contained in:
@@ -100,6 +100,7 @@ $script:cfg = @{
|
|||||||
PublicProtocol = $PublicProtocol
|
PublicProtocol = $PublicProtocol
|
||||||
AdminUser = $AdminUser
|
AdminUser = $AdminUser
|
||||||
AdminPass = $AdminPassword
|
AdminPass = $AdminPassword
|
||||||
|
AdminEmail = $null
|
||||||
TlsMode = $TlsMode
|
TlsMode = $TlsMode
|
||||||
CertFile = $CertFile
|
CertFile = $CertFile
|
||||||
KeyFile = $KeyFile
|
KeyFile = $KeyFile
|
||||||
@@ -271,6 +272,7 @@ function Load-ConfigFile {
|
|||||||
'public_protocol' { if (-not $script:cfg.PublicProtocol) { $script:cfg.PublicProtocol = $val } }
|
'public_protocol' { if (-not $script:cfg.PublicProtocol) { $script:cfg.PublicProtocol = $val } }
|
||||||
'admin_user' { if (-not $script:cfg.AdminUser) { $script:cfg.AdminUser = $val } }
|
'admin_user' { if (-not $script:cfg.AdminUser) { $script:cfg.AdminUser = $val } }
|
||||||
'admin_password' { if (-not $script:cfg.AdminPass) { $script:cfg.AdminPass = $val } }
|
'admin_password' { if (-not $script:cfg.AdminPass) { $script:cfg.AdminPass = $val } }
|
||||||
|
'admin_email' { if (-not $script:cfg.AdminEmail) { $script:cfg.AdminEmail = $val } }
|
||||||
'tls_mode' { if (-not $script:cfg.TlsMode) { $script:cfg.TlsMode = $val } }
|
'tls_mode' { if (-not $script:cfg.TlsMode) { $script:cfg.TlsMode = $val } }
|
||||||
'cert_file' { if (-not $script:cfg.CertFile) { $script:cfg.CertFile = $val } }
|
'cert_file' { if (-not $script:cfg.CertFile) { $script:cfg.CertFile = $val } }
|
||||||
'key_file' { if (-not $script:cfg.KeyFile) { $script:cfg.KeyFile = $val } }
|
'key_file' { if (-not $script:cfg.KeyFile) { $script:cfg.KeyFile = $val } }
|
||||||
@@ -303,6 +305,7 @@ function Load-EnvOverrides {
|
|||||||
if (-not $c.PublicProtocol) { $c.PublicProtocol = $_ENV_PUBLIC_PROTOCOL }
|
if (-not $c.PublicProtocol) { $c.PublicProtocol = $_ENV_PUBLIC_PROTOCOL }
|
||||||
if (-not $c.AdminUser) { $c.AdminUser = $env:SAAS_ADMIN_USER }
|
if (-not $c.AdminUser) { $c.AdminUser = $env:SAAS_ADMIN_USER }
|
||||||
if (-not $c.AdminPass) { $c.AdminPass = $env:SAAS_ADMIN_PASS }
|
if (-not $c.AdminPass) { $c.AdminPass = $env:SAAS_ADMIN_PASS }
|
||||||
|
if (-not $c.AdminEmail) { $c.AdminEmail = $env:SAAS_ADMIN_EMAIL }
|
||||||
if (-not $c.TlsMode) { $c.TlsMode = $_ENV_TLS_MODE }
|
if (-not $c.TlsMode) { $c.TlsMode = $_ENV_TLS_MODE }
|
||||||
if (-not $c.CertFile) { $c.CertFile = $_ENV_CERT_FILE }
|
if (-not $c.CertFile) { $c.CertFile = $_ENV_CERT_FILE }
|
||||||
if (-not $c.KeyFile) { $c.KeyFile = $_ENV_KEY_FILE }
|
if (-not $c.KeyFile) { $c.KeyFile = $_ENV_KEY_FILE }
|
||||||
@@ -598,6 +601,7 @@ function Validate-Config {
|
|||||||
function Generate-Passwords {
|
function Generate-Passwords {
|
||||||
$c = $script:cfg
|
$c = $script:cfg
|
||||||
if (-not $c.AdminPass) { $c.AdminPass = Generate-Password; Log-Info 'Generated admin password.' }
|
if (-not $c.AdminPass) { $c.AdminPass = Generate-Password; Log-Info 'Generated admin password.' }
|
||||||
|
if (-not $c.AdminEmail) { $c.AdminEmail = "$($c.AdminUser)@$($c.PublicHost)" }
|
||||||
if (-not $c.PostgresPassword) { $c.PostgresPassword = Generate-Password; Log-Info 'Generated PostgreSQL password.' }
|
if (-not $c.PostgresPassword) { $c.PostgresPassword = Generate-Password; Log-Info 'Generated PostgreSQL password.' }
|
||||||
if (-not $c.ClickhousePassword) { $c.ClickhousePassword = Generate-Password; Log-Info 'Generated ClickHouse password.' }
|
if (-not $c.ClickhousePassword) { $c.ClickhousePassword = Generate-Password; Log-Info 'Generated ClickHouse password.' }
|
||||||
}
|
}
|
||||||
@@ -708,6 +712,7 @@ POSTGRES_DB=cameleer_saas
|
|||||||
|
|
||||||
# Admin user
|
# Admin user
|
||||||
SAAS_ADMIN_USER=$($c.AdminUser)
|
SAAS_ADMIN_USER=$($c.AdminUser)
|
||||||
|
SAAS_ADMIN_EMAIL=$($c.AdminEmail)
|
||||||
|
|
||||||
# TLS
|
# TLS
|
||||||
NODE_TLS_REJECT=$($c.NodeTlsReject)
|
NODE_TLS_REJECT=$($c.NodeTlsReject)
|
||||||
@@ -971,6 +976,7 @@ public_host=$($c.PublicHost)
|
|||||||
auth_host=$($c.AuthHost)
|
auth_host=$($c.AuthHost)
|
||||||
public_protocol=$($c.PublicProtocol)
|
public_protocol=$($c.PublicProtocol)
|
||||||
admin_user=$($c.AdminUser)
|
admin_user=$($c.AdminUser)
|
||||||
|
admin_email=$($c.AdminEmail)
|
||||||
tls_mode=$($c.TlsMode)
|
tls_mode=$($c.TlsMode)
|
||||||
http_port=$($c.HttpPort)
|
http_port=$($c.HttpPort)
|
||||||
https_port=$($c.HttpsPort)
|
https_port=$($c.HttpsPort)
|
||||||
@@ -1031,6 +1037,7 @@ ClickHouse: default / $($c.ClickhousePassword)
|
|||||||
Admin Console: $($c.PublicProtocol)://$($c.PublicHost)/platform/
|
Admin Console: $($c.PublicProtocol)://$($c.PublicHost)/platform/
|
||||||
Admin User: $($c.AdminUser)
|
Admin User: $($c.AdminUser)
|
||||||
Admin Password: $($c.AdminPass)
|
Admin Password: $($c.AdminPass)
|
||||||
|
Admin Email: $($c.AdminEmail)
|
||||||
|
|
||||||
PostgreSQL: cameleer / $($c.PostgresPassword)
|
PostgreSQL: cameleer / $($c.PostgresPassword)
|
||||||
ClickHouse: default / $($c.ClickhousePassword)
|
ClickHouse: default / $($c.ClickhousePassword)
|
||||||
@@ -1334,6 +1341,7 @@ function Print-Credentials {
|
|||||||
}
|
}
|
||||||
Write-Host " Admin User: $($c.AdminUser)"
|
Write-Host " Admin User: $($c.AdminUser)"
|
||||||
Write-Host " Admin Password: $($c.AdminPass)"
|
Write-Host " Admin Password: $($c.AdminPass)"
|
||||||
|
Write-Host " Admin Email: $($c.AdminEmail)"
|
||||||
Write-Host ''
|
Write-Host ''
|
||||||
Write-Host " PostgreSQL: cameleer / $($c.PostgresPassword)"
|
Write-Host " PostgreSQL: cameleer / $($c.PostgresPassword)"
|
||||||
Write-Host " ClickHouse: default / $($c.ClickhousePassword)"
|
Write-Host " ClickHouse: default / $($c.ClickhousePassword)"
|
||||||
|
|||||||
11
install.sh
11
install.sh
@@ -56,6 +56,7 @@ AUTH_HOST=""
|
|||||||
PUBLIC_PROTOCOL=""
|
PUBLIC_PROTOCOL=""
|
||||||
ADMIN_USER=""
|
ADMIN_USER=""
|
||||||
ADMIN_PASS=""
|
ADMIN_PASS=""
|
||||||
|
ADMIN_EMAIL=""
|
||||||
TLS_MODE=""
|
TLS_MODE=""
|
||||||
CERT_FILE=""
|
CERT_FILE=""
|
||||||
KEY_FILE=""
|
KEY_FILE=""
|
||||||
@@ -168,6 +169,7 @@ parse_args() {
|
|||||||
--public-protocol) PUBLIC_PROTOCOL="$2"; shift ;;
|
--public-protocol) PUBLIC_PROTOCOL="$2"; shift ;;
|
||||||
--admin-user) ADMIN_USER="$2"; shift ;;
|
--admin-user) ADMIN_USER="$2"; shift ;;
|
||||||
--admin-password) ADMIN_PASS="$2"; shift ;;
|
--admin-password) ADMIN_PASS="$2"; shift ;;
|
||||||
|
--admin-email) ADMIN_EMAIL="$2"; shift ;;
|
||||||
--tls-mode) TLS_MODE="$2"; shift ;;
|
--tls-mode) TLS_MODE="$2"; shift ;;
|
||||||
--cert-file) CERT_FILE="$2"; shift ;;
|
--cert-file) CERT_FILE="$2"; shift ;;
|
||||||
--key-file) KEY_FILE="$2"; shift ;;
|
--key-file) KEY_FILE="$2"; shift ;;
|
||||||
@@ -262,6 +264,7 @@ load_config_file() {
|
|||||||
public_protocol) [ -z "$PUBLIC_PROTOCOL" ] && PUBLIC_PROTOCOL="$value" ;;
|
public_protocol) [ -z "$PUBLIC_PROTOCOL" ] && PUBLIC_PROTOCOL="$value" ;;
|
||||||
admin_user) [ -z "$ADMIN_USER" ] && ADMIN_USER="$value" ;;
|
admin_user) [ -z "$ADMIN_USER" ] && ADMIN_USER="$value" ;;
|
||||||
admin_password) [ -z "$ADMIN_PASS" ] && ADMIN_PASS="$value" ;;
|
admin_password) [ -z "$ADMIN_PASS" ] && ADMIN_PASS="$value" ;;
|
||||||
|
admin_email) [ -z "$ADMIN_EMAIL" ] && ADMIN_EMAIL="$value" ;;
|
||||||
tls_mode) [ -z "$TLS_MODE" ] && TLS_MODE="$value" ;;
|
tls_mode) [ -z "$TLS_MODE" ] && TLS_MODE="$value" ;;
|
||||||
cert_file) [ -z "$CERT_FILE" ] && CERT_FILE="$value" ;;
|
cert_file) [ -z "$CERT_FILE" ] && CERT_FILE="$value" ;;
|
||||||
key_file) [ -z "$KEY_FILE" ] && KEY_FILE="$value" ;;
|
key_file) [ -z "$KEY_FILE" ] && KEY_FILE="$value" ;;
|
||||||
@@ -292,6 +295,7 @@ load_env_overrides() {
|
|||||||
[ -z "$PUBLIC_PROTOCOL" ] && PUBLIC_PROTOCOL="$_ENV_PUBLIC_PROTOCOL"
|
[ -z "$PUBLIC_PROTOCOL" ] && PUBLIC_PROTOCOL="$_ENV_PUBLIC_PROTOCOL"
|
||||||
[ -z "$ADMIN_USER" ] && ADMIN_USER="${SAAS_ADMIN_USER:-}"
|
[ -z "$ADMIN_USER" ] && ADMIN_USER="${SAAS_ADMIN_USER:-}"
|
||||||
[ -z "$ADMIN_PASS" ] && ADMIN_PASS="${SAAS_ADMIN_PASS:-}"
|
[ -z "$ADMIN_PASS" ] && ADMIN_PASS="${SAAS_ADMIN_PASS:-}"
|
||||||
|
[ -z "$ADMIN_EMAIL" ] && ADMIN_EMAIL="${SAAS_ADMIN_EMAIL:-}"
|
||||||
[ -z "$TLS_MODE" ] && TLS_MODE="$_ENV_TLS_MODE"
|
[ -z "$TLS_MODE" ] && TLS_MODE="$_ENV_TLS_MODE"
|
||||||
[ -z "$CERT_FILE" ] && CERT_FILE="$_ENV_CERT_FILE"
|
[ -z "$CERT_FILE" ] && CERT_FILE="$_ENV_CERT_FILE"
|
||||||
[ -z "$KEY_FILE" ] && KEY_FILE="$_ENV_KEY_FILE"
|
[ -z "$KEY_FILE" ] && KEY_FILE="$_ENV_KEY_FILE"
|
||||||
@@ -597,6 +601,9 @@ generate_passwords() {
|
|||||||
ADMIN_PASS=$(generate_password)
|
ADMIN_PASS=$(generate_password)
|
||||||
log_info "Generated admin password."
|
log_info "Generated admin password."
|
||||||
fi
|
fi
|
||||||
|
if [ -z "$ADMIN_EMAIL" ]; then
|
||||||
|
ADMIN_EMAIL="${ADMIN_USER}@${PUBLIC_HOST:-localhost}"
|
||||||
|
fi
|
||||||
if [ -z "$POSTGRES_PASSWORD" ]; then
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
||||||
POSTGRES_PASSWORD=$(generate_password)
|
POSTGRES_PASSWORD=$(generate_password)
|
||||||
log_info "Generated PostgreSQL password."
|
log_info "Generated PostgreSQL password."
|
||||||
@@ -705,6 +712,7 @@ POSTGRES_DB=cameleer_saas
|
|||||||
|
|
||||||
# Admin user
|
# Admin user
|
||||||
SAAS_ADMIN_USER=${ADMIN_USER}
|
SAAS_ADMIN_USER=${ADMIN_USER}
|
||||||
|
SAAS_ADMIN_EMAIL=${ADMIN_EMAIL}
|
||||||
|
|
||||||
# TLS
|
# TLS
|
||||||
NODE_TLS_REJECT=${NODE_TLS_REJECT}
|
NODE_TLS_REJECT=${NODE_TLS_REJECT}
|
||||||
@@ -918,6 +926,7 @@ public_host=${PUBLIC_HOST}
|
|||||||
auth_host=${AUTH_HOST}
|
auth_host=${AUTH_HOST}
|
||||||
public_protocol=${PUBLIC_PROTOCOL}
|
public_protocol=${PUBLIC_PROTOCOL}
|
||||||
admin_user=${ADMIN_USER}
|
admin_user=${ADMIN_USER}
|
||||||
|
admin_email=${ADMIN_EMAIL}
|
||||||
tls_mode=${TLS_MODE}
|
tls_mode=${TLS_MODE}
|
||||||
http_port=${HTTP_PORT}
|
http_port=${HTTP_PORT}
|
||||||
https_port=${HTTPS_PORT}
|
https_port=${HTTPS_PORT}
|
||||||
@@ -974,6 +983,7 @@ EOF
|
|||||||
Admin Console: ${PUBLIC_PROTOCOL}://${PUBLIC_HOST}/platform/
|
Admin Console: ${PUBLIC_PROTOCOL}://${PUBLIC_HOST}/platform/
|
||||||
Admin User: ${ADMIN_USER}
|
Admin User: ${ADMIN_USER}
|
||||||
Admin Password: ${ADMIN_PASS}
|
Admin Password: ${ADMIN_PASS}
|
||||||
|
Admin Email: ${ADMIN_EMAIL}
|
||||||
|
|
||||||
PostgreSQL: cameleer / ${POSTGRES_PASSWORD}
|
PostgreSQL: cameleer / ${POSTGRES_PASSWORD}
|
||||||
ClickHouse: default / ${CLICKHOUSE_PASSWORD}
|
ClickHouse: default / ${CLICKHOUSE_PASSWORD}
|
||||||
@@ -1291,6 +1301,7 @@ print_credentials() {
|
|||||||
fi
|
fi
|
||||||
echo -e " Admin User: ${BOLD}${ADMIN_USER}${NC}"
|
echo -e " Admin User: ${BOLD}${ADMIN_USER}${NC}"
|
||||||
echo -e " Admin Password: ${BOLD}${ADMIN_PASS}${NC}"
|
echo -e " Admin Password: ${BOLD}${ADMIN_PASS}${NC}"
|
||||||
|
echo -e " Admin Email: ${BOLD}${ADMIN_EMAIL}${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e " PostgreSQL: cameleer / ${POSTGRES_PASSWORD}"
|
echo -e " PostgreSQL: cameleer / ${POSTGRES_PASSWORD}"
|
||||||
echo -e " ClickHouse: default / ${CLICKHOUSE_PASSWORD}"
|
echo -e " ClickHouse: default / ${CLICKHOUSE_PASSWORD}"
|
||||||
|
|||||||
Reference in New Issue
Block a user