Skip to content

Commit

Permalink
✨ Compatibility with official image
Browse files Browse the repository at this point in the history
Signed-off-by: mathieu.brunot <[email protected]>
  • Loading branch information
madmath03 committed May 6, 2021
1 parent 9e06b9e commit a4e87cb
Show file tree
Hide file tree
Showing 5 changed files with 375 additions and 375 deletions.
150 changes: 75 additions & 75 deletions images/4.2/alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ fi
#########################################

# Automatically replace "TAIGA_HOSTNAME" with the environment variable
sed -i "s|TAIGA_HOSTNAME|$TAIGA_HOSTNAME|g" /taiga/conf.json
sed -i "s|TAIGA_HOSTNAME|${TAIGA_HOSTNAME:-$TAIGA_SITES_DOMAIN}|g" /taiga/conf.json

# Look to see if we should set the "eventsUrl"
if [ -n "$TAIGA_EVENTS_ENABLED" ]; then
if [ -n "${TAIGA_EVENTS_ENABLED:-$EVENTS_ENABLED}" ]; then
log "Enabling Taiga Events"
sed -i \
-e "s|\"eventsUrl\": .*,|\"eventsUrl\": \"ws://$TAIGA_HOSTNAME/events\",|g" \
-e "s|\"eventsUrl\": .*,|\"eventsUrl\": \"ws://${TAIGA_HOSTNAME:-$TAIGA_SITES_DOMAIN}/events\",|g" \
/taiga/conf.json
else
log "Reset Taiga Events"
Expand All @@ -39,13 +39,13 @@ else
fi

# Handle enabling/disabling SSL
if [ "$TAIGA_SSL_BY_REVERSE_PROXY" = "True" ]; then
if [ "${TAIGA_SSL_BY_REVERSE_PROXY}" = "True" ]; then
log "Enabling external SSL support! SSL handling must be done by a reverse proxy or a similar system"
sed -i \
-e "s|http://|https://|g" \
-e "s|ws://|wss://|g" \
/taiga/conf.json
elif [ "$TAIGA_SSL" = "True" ]; then
elif [ "${TAIGA_SSL}" = "True" ]; then
log "Enabling SSL support!"
sed -i \
-e "s|http://|https://|g" \
Expand All @@ -59,31 +59,31 @@ elif grep -q "wss://" "/taiga/conf.json"; then
/taiga/conf.json
fi

if [ -n "$TAIGA_DEBUG" ]; then
log "Updating Taiga Front debug status: $TAIGA_DEBUG"
if [ -n "${TAIGA_DEBUG}" ]; then
log "Updating Taiga Front debug status: ${TAIGA_DEBUG}"
sed -i \
-e "s|\"debug\": .*,|\"debug\": $TAIGA_DEBUG,|g" \
-e "s|\"debug\": .*,|\"debug\": ${TAIGA_DEBUG},|g" \
/taiga/conf.json
fi

if [ -n "$TAIGA_DEBUG_INFO" ]; then
log "Updating Taiga Front debug info status: $TAIGA_DEBUG_INFO"
if [ -n "${TAIGA_DEBUG_INFO}" ]; then
log "Updating Taiga Front debug info status: ${TAIGA_DEBUG_INFO}"
sed -i \
-e "s|\"debugInfo\": .*,|\"debugInfo\": $TAIGA_DEBUG_INFO,|g" \
-e "s|\"debugInfo\": .*,|\"debugInfo\": ${TAIGA_DEBUG_INFO},|g" \
/taiga/conf.json
fi

if [ -n "$TAIGA_DEFAULT_LANGUAGE" ]; then
log "Updating Taiga Front default language: $TAIGA_DEFAULT_LANGUAGE"
if [ -n "${TAIGA_DEFAULT_LANGUAGE}" ]; then
log "Updating Taiga Front default language: ${TAIGA_DEFAULT_LANGUAGE}"
sed -i \
-e "s|\"defaultLanguage\": \".*\"|\"defaultLanguage\": \"$TAIGA_DEFAULT_LANGUAGE\"|g" \
-e "s|\"defaultLanguage\": \".*\"|\"defaultLanguage\": \"${TAIGA_DEFAULT_LANGUAGE}\"|g" \
/taiga/conf.json
fi

if [ -n "$TAIGA_THEMES" ]; then
log "Updating Taiga Front themes list: $TAIGA_THEMES"
if [ -n "${TAIGA_THEMES}" ]; then
log "Updating Taiga Front themes list: ${TAIGA_THEMES}"
themes_list=
for theme in $TAIGA_THEMES ; do
for theme in ${TAIGA_THEMES} ; do
themes_list="$themes_list\"$theme\", ";
done
sed -i \
Expand All @@ -96,31 +96,31 @@ else
/taiga/conf.json
fi

if [ -n "$TAIGA_DEFAULT_THEME" ]; then
log "Updating Taiga Front default theme: $TAIGA_DEFAULT_THEME"
if [ -n "${TAIGA_DEFAULT_THEME}" ]; then
log "Updating Taiga Front default theme: ${TAIGA_DEFAULT_THEME}"
sed -i \
-e "s|\"defaultTheme\": \".*\"|\"defaultTheme\": \"$TAIGA_DEFAULT_THEME\"|g" \
-e "s|\"defaultTheme\": \".*\"|\"defaultTheme\": \"${TAIGA_DEFAULT_THEME}\"|g" \
/taiga/conf.json
fi

if [ -n "$TAIGA_PUBLIC_REGISTER_ENABLED" ]; then
log "Updating Taiga Front public registration status: $TAIGA_PUBLIC_REGISTER_ENABLED"
if [ -n "${TAIGA_PUBLIC_REGISTER_ENABLED:-$PUBLIC_REGISTER_ENABLED}" ]; then
log "Updating Taiga Front public registration status: ${TAIGA_PUBLIC_REGISTER_ENABLED:-$PUBLIC_REGISTER_ENABLED}"
sed -i \
-e "s|\"publicRegisterEnabled\": .*,|\"publicRegisterEnabled\": $TAIGA_PUBLIC_REGISTER_ENABLED,|g" \
-e "s|\"publicRegisterEnabled\": .*,|\"publicRegisterEnabled\": ${TAIGA_PUBLIC_REGISTER_ENABLED:-$PUBLIC_REGISTER_ENABLED},|g" \
/taiga/conf.json
fi

if [ -n "$TAIGA_FEEDBACK_ENABLED" ]; then
log "Updating Taiga Front feedback status: $TAIGA_FEEDBACK_ENABLED"
if [ -n "${TAIGA_FEEDBACK_ENABLED:-$FEEDBACK_ENABLED}" ]; then
log "Updating Taiga Front feedback status: ${TAIGA_FEEDBACK_ENABLED:-$FEEDBACK_ENABLED}"
sed -i \
-e "s|\"feedbackEnabled\": .*,|\"feedbackEnabled\": $TAIGA_FEEDBACK_ENABLED,|g" \
-e "s|\"feedbackEnabled\": .*,|\"feedbackEnabled\": ${TAIGA_FEEDBACK_ENABLED:-$FEEDBACK_ENABLED},|g" \
/taiga/conf.json
fi

if [ -n "$TAIGA_SUPPORT_URL" ]; then
log "Updating Taiga Front support URL: $TAIGA_SUPPORT_URL"
if [ -n "${TAIGA_SUPPORT_URL}" ]; then
log "Updating Taiga Front support URL: ${TAIGA_SUPPORT_URL}"
sed -i \
-e "s|\"supportUrl\": .*,|\"supportUrl\": \"$TAIGA_SUPPORT_URL\",|g" \
-e "s|\"supportUrl\": .*,|\"supportUrl\": \"${TAIGA_SUPPORT_URL}\",|g" \
/taiga/conf.json
else
log "Reset Taiga Front support URL"
Expand All @@ -129,10 +129,10 @@ else
/taiga/conf.json
fi

if [ -n "$TAIGA_PRIVACY_POLICY_URL" ]; then
log "Updating Taiga Front privacy policy URL: $TAIGA_PRIVACY_POLICY_URL"
if [ -n "${TAIGA_PRIVACY_POLICY_URL}" ]; then
log "Updating Taiga Front privacy policy URL: ${TAIGA_PRIVACY_POLICY_URL}"
sed -i \
-e "s|\"privacyPolicyUrl\": .*,|\"privacyPolicyUrl\": \"$TAIGA_PRIVACY_POLICY_URL\",|g" \
-e "s|\"privacyPolicyUrl\": .*,|\"privacyPolicyUrl\": \"${TAIGA_PRIVACY_POLICY_URL}\",|g" \
/taiga/conf.json
else
log "Reset Taiga Front privacy policy URL"
Expand All @@ -141,10 +141,10 @@ else
/taiga/conf.json
fi

if [ -n "$TAIGA_TOS_URL" ]; then
log "Updating Taiga Front terms of services URL: $TAIGA_TOS_URL"
if [ -n "${TAIGA_TOS_URL}" ]; then
log "Updating Taiga Front terms of services URL: ${TAIGA_TOS_URL}"
sed -i \
-e "s|\"termsOfServiceUrl\": .*,|\"termsOfServiceUrl\": \"$TAIGA_TOS_URL\",|g" \
-e "s|\"termsOfServiceUrl\": .*,|\"termsOfServiceUrl\": \"${TAIGA_TOS_URL}\",|g" \
/taiga/conf.json
else
log "Reset Taiga Front terms of services URL"
Expand All @@ -153,10 +153,10 @@ else
/taiga/conf.json
fi

if [ -n "$TAIGA_GDPR_URL" ]; then
log "Updating Taiga Front GDPR compliance URL: $TAIGA_GDPR_URL"
if [ -n "${TAIGA_GDPR_URL}" ]; then
log "Updating Taiga Front GDPR compliance URL: ${TAIGA_GDPR_URL}"
sed -i \
-e "s|\"GDPRUrl\": .*,|\"GDPRUrl\": \"$TAIGA_GDPR_URL\",|g" \
-e "s|\"GDPRUrl\": .*,|\"GDPRUrl\": \"${TAIGA_GDPR_URL}\",|g" \
/taiga/conf.json
else
log "Reset Taiga Front GDPR compliance URL"
Expand All @@ -165,10 +165,10 @@ else
/taiga/conf.json
fi

if [ -n "$TAIGA_MAX_UPLOAD_SIZE" ]; then
log "Updating Taiga Front max upload file size: $TAIGA_MAX_UPLOAD_SIZE"
if [ -n "${TAIGA_MAX_UPLOAD_SIZE}" ]; then
log "Updating Taiga Front max upload file size: ${TAIGA_MAX_UPLOAD_SIZE}"
sed -i \
-e "s|\"maxUploadFileSize\": .*,|\"maxUploadFileSize\": $TAIGA_MAX_UPLOAD_SIZE,|g" \
-e "s|\"maxUploadFileSize\": .*,|\"maxUploadFileSize\": ${TAIGA_MAX_UPLOAD_SIZE},|g" \
/taiga/conf.json
else
log "Reset Taiga Front GDPR URL"
Expand All @@ -177,10 +177,10 @@ else
/taiga/conf.json
fi

if [ -n "$TAIGA_CONTRIB_PLUGINS" ]; then
log "Updating Taiga Front contribution plugins list: $TAIGA_CONTRIB_PLUGINS"
if [ -n "${TAIGA_CONTRIB_PLUGINS}" ]; then
log "Updating Taiga Front contribution plugins list: ${TAIGA_CONTRIB_PLUGINS}"
plugins_list=
for plugin in $TAIGA_CONTRIB_PLUGINS ; do
for plugin in ${TAIGA_CONTRIB_PLUGINS} ; do
plugins_list="$plugins_list\"/plugins/$plugin/$plugin.json\", ";
done
sed -i \
Expand All @@ -193,10 +193,10 @@ else
/taiga/conf.json
fi

if [ -n "$TAIGA_IMPORTERS" ]; then
log "Updating Taiga Front importers list: $TAIGA_IMPORTERS"
if [ -n "${TAIGA_IMPORTERS}" ]; then
log "Updating Taiga Front importers list: ${TAIGA_IMPORTERS}"
importers_list=
for importer in $TAIGA_IMPORTERS ; do
for importer in ${TAIGA_IMPORTERS} ; do
importers_list="$importers_list \"$importer\",";
done
sed -i \
Expand All @@ -209,45 +209,45 @@ else
/taiga/conf.json
fi

if [ -n "$TAIGA_IMPORTER_GITHUB_ENABLED" ]; then
log "Updating Taiga Front GitHub importer status: $TAIGA_IMPORTER_GITHUB_ENABLED"
if [ -n "${TAIGA_IMPORTER_GITHUB_ENABLED:-$ENABLE_GITHUB_IMPORTER}" ]; then
log "Updating Taiga Front GitHub importer status: ${TAIGA_IMPORTER_GITHUB_ENABLED:-$ENABLE_GITHUB_IMPORTER}"
sed -i \
-e "s|\"enableGithubImporter\": .*,|\"enableGithubImporter\": $TAIGA_IMPORTER_GITHUB_ENABLED,|g" \
-e "s|\"enableGithubImporter\": .*,|\"enableGithubImporter\": ${TAIGA_IMPORTER_GITHUB_ENABLED:-$ENABLE_GITHUB_IMPORTER},|g" \
/taiga/conf.json
fi

if [ -n "$TAIGA_IMPORTER_JIRA_ENABLED" ]; then
log "Updating Taiga Front Jira importer status: $TAIGA_IMPORTER_JIRA_ENABLED"
if [ -n "${TAIGA_IMPORTER_JIRA_ENABLED:-$ENABLE_JIRA_IMPORTER}" ]; then
log "Updating Taiga Front Jira importer status: ${TAIGA_IMPORTER_JIRA_ENABLED:-$ENABLE_JIRA_IMPORTER}"
sed -i \
-e "s|\"enableJiraImporter\": .*,|\"enableJiraImporter\": $TAIGA_IMPORTER_JIRA_ENABLED,|g" \
-e "s|\"enableJiraImporter\": .*,|\"enableJiraImporter\": ${TAIGA_IMPORTER_JIRA_ENABLED:-$ENABLE_JIRA_IMPORTER},|g" \
/taiga/conf.json
fi

if [ -n "$TAIGA_IMPORTER_TRELLO_ENABLED" ]; then
log "Updating Taiga Front Trello importer status: $TAIGA_IMPORTER_TRELLO_ENABLED"
if [ -n "${TAIGA_IMPORTER_TRELLO_ENABLED:-$ENABLE_TRELLO_IMPORTER}" ]; then
log "Updating Taiga Front Trello importer status: ${TAIGA_IMPORTER_TRELLO_ENABLED:-$ENABLE_TRELLO_IMPORTER}"
sed -i \
-e "s|\"enableTrelloImporter\": .*,|\"enableTrelloImporter\": $TAIGA_IMPORTER_TRELLO_ENABLED,|g" \
-e "s|\"enableTrelloImporter\": .*,|\"enableTrelloImporter\": ${TAIGA_IMPORTER_TRELLO_ENABLED:-$ENABLE_TRELLO_IMPORTER},|g" \
/taiga/conf.json
fi

if [ -n "$TAIGA_IMPORTER_ASANA_ENABLED" ]; then
log "Updating Taiga Front Asana importer status: $TAIGA_IMPORTER_ASANA_ENABLED"
if [ -n "${TAIGA_IMPORTER_ASANA_ENABLED:-$ENABLE_ASANA_IMPORTER}" ]; then
log "Updating Taiga Front Asana importer status: ${TAIGA_IMPORTER_ASANA_ENABLED:-$ENABLE_ASANA_IMPORTER}"
sed -i \
-e "s|\"enableAsanaImporter\": .*,|\"enableAsanaImporter\": $TAIGA_IMPORTER_ASANA_ENABLED,|g" \
-e "s|\"enableAsanaImporter\": .*,|\"enableAsanaImporter\": ${TAIGA_IMPORTER_ASANA_ENABLED:-$ENABLE_ASANA_IMPORTER},|g" \
/taiga/conf.json
fi

if [ -n "$TAIGA_GRAVATAR" ]; then
log "Updating Taiga Front Gravatar status: $TAIGA_GRAVATAR"
if [ -n "${TAIGA_GRAVATAR:-$ENABLE_GRAVATAR}" ]; then
log "Updating Taiga Front Gravatar status: ${TAIGA_GRAVATAR:-$ENABLE_GRAVATAR}"
sed -i \
-e "s|\"gravatar\": .*,|\"gravatar\": $TAIGA_GRAVATAR,|g" \
-e "s|\"gravatar\": .*,|\"gravatar\": ${TAIGA_GRAVATAR:-$ENABLE_GRAVATAR},|g" \
/taiga/conf.json
fi

if [ -n "$TAIGA_LOGIN_FORM_TYPE" ]; then
log "Updating Taiga Front login form type: $TAIGA_LOGIN_FORM_TYPE"
if [ -n "${TAIGA_LOGIN_FORM_TYPE}" ]; then
log "Updating Taiga Front login form type: ${TAIGA_LOGIN_FORM_TYPE}"
sed -i \
-e "s|\"loginFormType\": \".*\"|\"loginFormType\": \"$TAIGA_LOGIN_FORM_TYPE\"|g" \
-e "s|\"loginFormType\": \".*\"|\"loginFormType\": \"${TAIGA_LOGIN_FORM_TYPE}\"|g" \
/taiga/conf.json
else
log "Reset Taiga Front login form type"
Expand All @@ -265,8 +265,8 @@ if [ -d /etc/nginx/conf.d/ ]; then
rm -f /etc/nginx/conf.d/*.conf
fi

if [ "$TAIGA_SSL" = "True" ]; then
if [ -n "$TAIGA_EVENTS_ENABLED" ]; then
if [ "${TAIGA_SSL}" = "True" ]; then
if [ -n "${TAIGA_EVENTS_ENABLED:-$EVENTS_ENABLED}" ]; then
ln -s \
/etc/nginx/sites-available/taiga-events-ssl.conf \
/etc/nginx/conf.d/taiga.conf
Expand All @@ -276,7 +276,7 @@ if [ "$TAIGA_SSL" = "True" ]; then
/etc/nginx/conf.d/taiga.conf
fi
else
if [ -n "$TAIGA_EVENTS_ENABLED" ]; then
if [ -n "${TAIGA_EVENTS_ENABLED:-$EVENTS_ENABLED}" ]; then
ln -s \
/etc/nginx/sites-available/taiga-events.conf \
/etc/nginx/conf.d/taiga.conf
Expand All @@ -288,7 +288,7 @@ else
fi

# Update proxy pass if backend served with SSL
if [ "$TAIGA_BACKEND_SSL" = "True" ]; then
if [ "${TAIGA_BACKEND_SSL}" = "True" ]; then
sed -i \
-e "s|http://|https://|g" \
/etc/nginx/snippets/api.conf
Expand All @@ -299,18 +299,18 @@ else
fi

# Look to see if we should update the backend connection
if [ -n "$TAIGA_BACK_HOST" ]; then
log "Updating Taiga Back connection: $TAIGA_BACK_HOST"
if [ -n "${TAIGA_BACK_HOST}" ]; then
log "Updating Taiga Back connection: ${TAIGA_BACK_HOST}"
sed -i \
-e "s|server .*;|server $TAIGA_BACK_HOST:$TAIGA_BACK_PORT;|g" \
-e "s|server .*;|server ${TAIGA_BACK_HOST}:${TAIGA_BACK_PORT:-8001};|g" \
/etc/nginx/snippets/upstream.conf
fi

# Look to see if we should update the events connection
if [ -n "$TAIGA_EVENTS_HOST" ]; then
log "Updating Taiga Events connection: $TAIGA_EVENTS_HOST"
if [ -n "${TAIGA_EVENTS_HOST}" ]; then
log "Updating Taiga Events connection: ${TAIGA_EVENTS_HOST}"
sed -i \
-e "s|proxy_pass http://.*/events|proxy_pass http://$TAIGA_EVENTS_HOST:$TAIGA_EVENTS_PORT/events|g" \
-e "s|proxy_pass http://.*/events|proxy_pass http://${TAIGA_EVENTS_HOST}:${TAIGA_EVENTS_PORT:-8888}/events|g" \
/etc/nginx/snippets/events.conf
fi

Expand Down
Loading

0 comments on commit a4e87cb

Please sign in to comment.