-
Notifications
You must be signed in to change notification settings - Fork 9
335 feature request automatically send user invite link #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6ee2669
e75a6a4
5c4352d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,6 +15,19 @@ readonly THUNDER_CONSOLE_CONFIG="${ROOT_DIR}/silver-config/thunder/console-confi | |||||||||||||
| readonly THUNDER_GATE_CONFIG="${ROOT_DIR}/silver-config/thunder/gate-config.js" | ||||||||||||||
| readonly THUNDER_PORT="8090" | ||||||||||||||
|
|
||||||||||||||
| # Load services/.env so SMTP credentials (and any other overrides) are available. | ||||||||||||||
| if [[ -f "${ROOT_DIR}/.env" ]]; then | ||||||||||||||
| set -a | ||||||||||||||
| source "${ROOT_DIR}/.env" | ||||||||||||||
| set +a | ||||||||||||||
| fi | ||||||||||||||
|
|
||||||||||||||
| # SMTP values derived from the primary domain (password from .env, optional). | ||||||||||||||
| readonly SMTP_HOST="mail.${MAIL_DOMAIN}" | ||||||||||||||
| readonly SMTP_USERNAME="contact@${MAIL_DOMAIN}" | ||||||||||||||
| readonly SMTP_FROM_ADDRESS="contact@${MAIL_DOMAIN}" | ||||||||||||||
| readonly SMTP_PASSWORD="${THUNDER_SMTP_PASSWORD:-}" | ||||||||||||||
|
|
||||||||||||||
| mkdir -p "${THUNDER_CERTS_PATH}" | ||||||||||||||
|
|
||||||||||||||
| cp "${LETSENCRYPT_PATH}/fullchain.pem" "${THUNDER_CERTS_PATH}/server.cert" | ||||||||||||||
|
|
@@ -48,10 +61,19 @@ if [[ -f "${THUNDER_DEPLOYMENT_FILE}" ]]; then | |||||||||||||
|
|
||||||||||||||
| # Update passkey.allowed_origins - replace any https://domain:port pattern | ||||||||||||||
| sed -i'' -e "/^passkey:/,/^[^ ]/ s|https://[^:\"]*:[0-9]*|https://${MAIL_DOMAIN}:${THUNDER_PORT}|g" "${THUNDER_DEPLOYMENT_FILE}" | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| # Update email.smtp host/username/from_address (and password if env var set). | ||||||||||||||
| # The sed range targets lines within the `email:` block only. | ||||||||||||||
| sed -i'' -e "/^email:/,/^[^ ]/ s|host:.*|host: \"${SMTP_HOST}\"|" "${THUNDER_DEPLOYMENT_FILE}" | ||||||||||||||
| sed -i'' -e "/^email:/,/^[^ ]/ s|username:.*|username: \"${SMTP_USERNAME}\"|" "${THUNDER_DEPLOYMENT_FILE}" | ||||||||||||||
| sed -i'' -e "/^email:/,/^[^ ]/ s|from_address:.*|from_address: \"${SMTP_FROM_ADDRESS}\"|" "${THUNDER_DEPLOYMENT_FILE}" | ||||||||||||||
|
Comment on lines
+67
to
+69
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The sed substitution patterns are a bit broad and could accidentally match other keys that contain these strings (e.g., smtp_host: or backup_host:). It's safer to anchor the match to the start of the line and preserve indentation using a capture group. Additionally, the range /^email:/,/^[^ ]/ can be fragile if there are comments starting at the first column within the email: block, as sed will stop the range at the first such comment. Quoting numeric or string values in the generated YAML is acceptable per repository guidelines.
Suggested change
References
|
||||||||||||||
| if [[ -n "${SMTP_PASSWORD}" ]]; then | ||||||||||||||
| sed -i'' -e "/^email:/,/^[^ ]/ s|password:.*|password: \"${SMTP_PASSWORD}\"|" "${THUNDER_DEPLOYMENT_FILE}" | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anchoring the match to the start of the line is recommended here as well to avoid accidental matches with other keys. Quoting the value as a string is acceptable per repository guidelines.
Suggested change
References
|
||||||||||||||
| fi | ||||||||||||||
|
|
||||||||||||||
| # Remove backup file | ||||||||||||||
| rm -f "${THUNDER_DEPLOYMENT_FILE}.bak" | ||||||||||||||
|
|
||||||||||||||
| echo -e "Thunder deployment configuration updated with domain: ${MAIL_DOMAIN} and port: ${THUNDER_PORT}" | ||||||||||||||
| else | ||||||||||||||
| echo -e "Warning: Thunder deployment.yaml not found at ${THUNDER_DEPLOYMENT_FILE}" | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging the generated password to stdout is a security risk, as these logs may be persisted in container logs or monitoring systems. Since this script is intended for automated setup, consider providing the password via an environment variable (which is already supported via THUNDER_SMTP_PASSWORD) and only generating/printing it as a last resort. If it must be printed, ensure the environment is secure and logs are handled appropriately.