Skip to content

Commit

Permalink
Add APP_KEYS and make all secret variables conditional
Browse files Browse the repository at this point in the history
Every variable that should be added as a secret for Strapi and is falling back to PROJECT_ENTROPY has been made conditional, so that if it is set, it is not overriden by the .environment file.

Fix #178
  • Loading branch information
akalipetis committed Nov 23, 2023
1 parent db57b75 commit 4a09df7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions platformifier/templates/generic/.environment
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ export DATABASE_PORT="$DB_PORT"
export DATABASE_NAME="$DB_PATH"
export DATABASE_USERNAME="$DB_USERNAME"
export DATABASE_PASSWORD="$DB_PASSWORD"
export DATABASE_SCHEME="$DB_SCHEME"
export DATABASE_SCHEME="$DB_CONNECTION"

# Set secrets needed by Strapi, if they are not set
# Prefer setting these as project secret variables with {{ .Assets.Binary }} variable:create env:SECRET_NAME --sensitive=true
if [ -z "$ADMIN_JWT_SECRET" ]; then
if [[ -z "$ADMIN_JWT_SECRET" ]]; then
export ADMIN_JWT_SECRET="${{ .Assets.EnvPrefix }}_PROJECT_ENTROPY"
fi
if [ -z "$JWT_SECRET" ]; then
if [[ -z "$JWT_SECRET" ]]; then
export JWT_SECRET="${{ .Assets.EnvPrefix }}_PROJECT_ENTROPY"
fi
if [ -z "$API_TOKEN_SALT"]; then
if [[ -z "$API_TOKEN_SALT" ]]; then
export API_TOKEN_SALT="${{ .Assets.EnvPrefix }}_PROJECT_ENTROPY"
fi
if [ -z "$APP_KEYS" ]; then
if [[ -z "$APP_KEYS" ]]; then
export APP_KEYS="${{ .Assets.EnvPrefix }}_PROJECT_ENTROPY"
fi
{{- end -}}
8 changes: 4 additions & 4 deletions platformifier/templates/upsun/.environment
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ export DATABASE_SCHEME="$DB_SCHEME"

# Set secrets needed by Strapi, if they are not set
# Prefer setting these as project secret variables with {{ .Assets.Binary }} variable:create env:SECRET_NAME --sensitive=true
if [ -z "$ADMIN_JWT_SECRET" ]; then
if [[ -z "$ADMIN_JWT_SECRET" ]]; then
export ADMIN_JWT_SECRET="${{ .Assets.EnvPrefix }}_PROJECT_ENTROPY"
fi
if [ -z "$JWT_SECRET" ]; then
if [[ -z "$JWT_SECRET" ]]; then
export JWT_SECRET="${{ .Assets.EnvPrefix }}_PROJECT_ENTROPY"
fi
if [ -z "$API_TOKEN_SALT"]; then
if [[ -z "$API_TOKEN_SALT" ]]; then
export API_TOKEN_SALT="${{ .Assets.EnvPrefix }}_PROJECT_ENTROPY"
fi
if [ -z "$APP_KEYS" ]; then
if [[ -z "$APP_KEYS" ]]; then
export APP_KEYS="${{ .Assets.EnvPrefix }}_PROJECT_ENTROPY"
fi
{{- end -}}

0 comments on commit 4a09df7

Please sign in to comment.