diff --git a/docker/images/config.env b/docker/images/config.env index 157d2be43..15474b764 100644 --- a/docker/images/config.env +++ b/docker/images/config.env @@ -33,19 +33,14 @@ PENPOT_SMTP_DEFAULT_REPLY_TO=no-reply@example.com # PENPOT_SMTP_USERNAME= # PENPOT_SMTP_PASSWORD= # PENPOT_SMTP_TLS=true -# PENPOT_SMTP_SSL=false +# PENPOT_SMTP_SSL=false -# Enable or disable external user registration process. -PENPOT_REGISTRATION_ENABLED=true +# Flags that enables features on frontend applitation. +PENPOT_FRONTEND_FLAGS="enable-registration enable-demo-users" # Comma separated list of allowed domains to register. Empty to allow all. # PENPOT_REGISTRATION_DOMAIN_WHITELIST="" -# Penpot comes with the facility to create quick demo users that are -# automatically deleted after some time. This settings enables or disables the -# creation of demo users. -PENPOT_ALLOW_DEMO_USERS=true - ## Authentication providers # Google diff --git a/docker/images/files/nginx-entrypoint.sh b/docker/images/files/nginx-entrypoint.sh index 8e2c645f8..53328434c 100644 --- a/docker/images/files/nginx-entrypoint.sh +++ b/docker/images/files/nginx-entrypoint.sh @@ -9,26 +9,6 @@ log() { ## App Frontend config ######################################### -update_demo_warning() { - if [ -n "$PENPOT_DEMO_WARNING" ]; then - log "Updating Demo Warning: $PENPOT_DEMO_WARNING" - sed -i \ - -e "s|^//var penpotDemoWarning = .*;|var penpotDemoWarning = $PENPOT_DEMO_WARNING;|g" \ - "$1" - fi -} - - -update_allow_demo_users() { - if [ -n "$PENPOT_ALLOW_DEMO_USERS" ]; then - log "Updating Allow Demo Users: $PENPOT_ALLOW_DEMO_USERS" - sed -i \ - -e "s|^//var penpotAllowDemoUsers = .*;|var penpotAllowDemoUsers = $PENPOT_ALLOW_DEMO_USERS;|g" \ - "$1" - fi -} - - update_google_client_id() { if [ -n "$PENPOT_GOOGLE_CLIENT_ID" ]; then log "Updating Google Client Id: $PENPOT_GOOGLE_CLIENT_ID" @@ -67,6 +47,7 @@ update_oidc_client_id() { fi } +# DEPRECATED update_login_with_ldap() { if [ -n "$PENPOT_LOGIN_WITH_LDAP" ]; then log "Updating Login with LDAP: $PENPOT_LOGIN_WITH_LDAP" @@ -76,7 +57,7 @@ update_login_with_ldap() { fi } - +# DEPRECATED update_registration_enabled() { if [ -n "$PENPOT_REGISTRATION_ENABLED" ]; then log "Updating Registration Enabled: $PENPOT_REGISTRATION_ENABLED" @@ -86,30 +67,19 @@ update_registration_enabled() { fi } -update_analytics_enabled() { - if [ -n "$PENPOT_ANALYTICS_ENABLED" ]; then - sed -i \ - -e "s|^//var penpotAnalyticsEnabled = .*;|var penpotAnalyticsEnabled = $PENPOT_ANALYTICS_ENABLED;|g" \ - "$1" - fi -} - update_flags() { - if [ -n "$PENPOT_FLAGS" ]; then + if [ -n "$PENPOT_FRONTEND_FLAGS" ]; then sed -i \ - -e "s|^//var penpotFlags = .*;|var penpotFlags = \"$PENPOT_FLAGS\";|g" \ + -e "s|^//var penpotFlags = .*;|var penpotFlags = \"$PENPOT_FRONTEND_FLAGS\";|g" \ "$1" fi } -update_demo_warning /var/www/app/js/config.js -update_allow_demo_users /var/www/app/js/config.js update_google_client_id /var/www/app/js/config.js update_gitlab_client_id /var/www/app/js/config.js update_github_client_id /var/www/app/js/config.js update_oidc_client_id /var/www/app/js/config.js update_login_with_ldap /var/www/app/js/config.js update_registration_enabled /var/www/app/js/config.js -update_analytics_enabled /var/www/app/js/config.js update_flags /var/www/app/js/config.js exec "$@"; diff --git a/frontend/src/app/config.cljs b/frontend/src/app/config.cljs index 24346505d..2282fb825 100644 --- a/frontend/src/app/config.cljs +++ b/frontend/src/app/config.cljs @@ -54,6 +54,15 @@ :browser :webworker)) +(def available-flags + #{:registration + :audit-log + :demo-users + :user-feedback + :demo-users + :demo-warning + :login-with-ldap}) + (def default-flags #{:registration :demo-users})