mirror of
https://github.com/penpot/penpot.git
synced 2025-03-10 14:51:37 -05:00
🐳 Frontend configuration on env var
Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>
This commit is contained in:
parent
1ebce37e17
commit
bb15924c95
3 changed files with 97 additions and 0 deletions
|
@ -2,6 +2,7 @@ FROM nginx:latest
|
|||
LABEL maintainer="Andrey Antukh <niwi@niwi.nz>"
|
||||
|
||||
ADD ./bundle/frontend /var/www/app/
|
||||
ADD ./files/config.js /var/www/app/js/config.js
|
||||
ADD ./files/nginx.conf /etc/nginx/nginx.conf
|
||||
ADD ./files/nginx-entrypoint.sh /entrypoint.sh
|
||||
|
||||
|
|
9
docker/images/files/config.js
Normal file
9
docker/images/files/config.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
// Frontend configuration
|
||||
|
||||
//var penpotPublicURI = "https://penpot.example.com";
|
||||
//var penpotDemoWarning = <true|false>;
|
||||
//var penpotAllowDemoUsers = <true|false>;
|
||||
//var penpotGoogleClientID = "<google-client-id-here>";
|
||||
//var penpotGitlabClientID = "<gitlab-client-id-here>";
|
||||
//var penpotGithubClientID = "<github-client-id-here>";
|
||||
//var penpotLoginWithLDAP = <true|false>;
|
|
@ -1,3 +1,90 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
log() {
|
||||
echo "[$(date +%Y-%m-%dT%H:%M:%S%:z)] $*"
|
||||
}
|
||||
|
||||
|
||||
#########################################
|
||||
## App Frontend config
|
||||
#########################################
|
||||
|
||||
|
||||
update_public_uri() {
|
||||
if [ -n "$PENPOT_PUBLIC_URI" ]; then
|
||||
log "Updating Public URI: $PENPOT_PUBLIC_URI"
|
||||
sed -i \
|
||||
-e "s|^//var penpotPublicURI = \".*\";|var penpotPublicURI = \"$PENPOT_PUBLIC_URI\";|g" \
|
||||
"$1"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
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"
|
||||
sed -i \
|
||||
-e "s|^//var penpotGoogleClientID = \".*\";|var penpotGoogleClientID = \"$PENPOT_GOOGLE_CLIENT_ID\";|g" \
|
||||
"$1"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
update_gitlab_client_id() {
|
||||
if [ -n "$PENPOT_GITLAB_CLIENT_ID" ]; then
|
||||
log "Updating GitLab Client Id: $PENPOT_GITLAB_CLIENT_ID"
|
||||
sed -i \
|
||||
-e "s|^//var penpotGitlabClientID = \".*\";|var penpotGitlabClientID = \"$PENPOT_GITLAB_CLIENT_ID\";|g" \
|
||||
"$1"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
update_github_client_id() {
|
||||
if [ -n "$PENPOT_GITHUB_CLIENT_ID" ]; then
|
||||
log "Updating GitHub Client Id: $PENPOT_GITHUB_CLIENT_ID"
|
||||
sed -i \
|
||||
-e "s|^//var penpotGithubClientID = \".*\";|var penpotGithubClientID = \"$PENPOT_GITHUB_CLIENT_ID\";|g" \
|
||||
"$1"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
update_login_with_ldap() {
|
||||
if [ -n "$PENPOT_LOGIN_WITH_LDAP" ]; then
|
||||
log "Updating Login with LDAP: $PENPOT_LOGIN_WITH_LDAP"
|
||||
sed -i \
|
||||
-e "s|^//var penpotLoginWithLDAP = .*;|var penpotLoginWithLDAP = $PENPOT_LOGIN_WITH_LDAP;|g" \
|
||||
"$1"
|
||||
fi
|
||||
}
|
||||
|
||||
update_public_uri /var/www/app/js/config.js
|
||||
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_login_with_ldap /var/www/app/js/config.js
|
||||
|
||||
exec "$@";
|
||||
|
|
Loading…
Add table
Reference in a new issue