mirror of
https://codeberg.org/SafeTwitch/safetwitch.git
synced 2024-12-21 21:03:00 -05:00
Fix env variables
This commit is contained in:
parent
8c7750b695
commit
4468ff0c32
3 changed files with 16 additions and 4 deletions
|
@ -7,9 +7,15 @@ FROM docker.io/node:16 AS builder
|
|||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
# Filled with placeholders, later changed and managed
|
||||
# by the substitute_environment_variables.sh file
|
||||
ENV SAFETWITCH_BACKEND_DOMAIN SAFETWITCH_BACKEND_DOMAIN_PLACEHOLDER
|
||||
ENV SAFETWITCH_INSTANCE_DOMAIN SAFETWITCH_INSTANCE_DOMAIN_PLACEHOLDER
|
||||
ENV SAFETWITCH_HTTPS SAFETWITCH_HTTPS_PLACEHOLDER
|
||||
ENV SAFETWITCH_DEFAULT_LOCALE SAFETWITCH_DEFAULT_LOCALE_PLACEHOLDER
|
||||
ENV SAFETWITCH_FALLBACK_LOCALE SAFETWITCH_FALLBACK_LOCALE_PLACEHOLDER
|
||||
ENV SAFETWITCH_DEFAULT_THEME SAFETWITCH_DEFAULT_THEME_PLACEHOLDER
|
||||
# Copy all files from current directory to working dir in image
|
||||
COPY . .
|
||||
# install node modules and build assets
|
||||
|
@ -23,7 +29,7 @@ RUN mkdir /app
|
|||
# Copy static assets from builder stage
|
||||
COPY --from=builder /app/dist /app
|
||||
# Containers run nginx with global directives and daemon off
|
||||
EXPOSE 80
|
||||
EXPOSE 8280
|
||||
|
||||
# Overriding the default NGINX container behavior
|
||||
COPY ./substitute_environment_variables.sh ./substitute_environment_variables.sh
|
||||
|
|
|
@ -17,8 +17,8 @@ import zh_Hans from '@/locales/zh_Hans.json'
|
|||
|
||||
export default createI18n({
|
||||
legacy: false,
|
||||
locale: import.meta.env.VUE_APP_I18N_LOCALE || 'en-US',
|
||||
fallbackLocale: import.meta.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en-US',
|
||||
locale: import.meta.env.SAFETWITCH_DEFAULT_LOCALE || 'en-US',
|
||||
fallbackLocale: import.meta.env.SAFETWITCH_FALLBACK_LOCALE || 'en-US',
|
||||
globalInjection: true,
|
||||
messages: {
|
||||
'en-US': en,
|
||||
|
|
|
@ -10,7 +10,9 @@ else
|
|||
export SAFETWITCH_BACKEND_DOMAIN_PLACEHOLDER=SAFETWITCH_BACKEND_DOMAIN_PLACEHOLDER
|
||||
export SAFETWITCH_INSTANCE_DOMAIN_PLACEHOLDER=SAFETWITCH_INSTANCE_DOMAIN_PLACEHOLDER
|
||||
export SAFETWITCH_HTTPS_PLACEHOLDER=SAFETWITCH_HTTPS_PLACEHOLDER
|
||||
export SAFETWITCH_DEFAULT_THEME_PLACEHOLDER=light
|
||||
export SAFETWITCH_DEFAULT_THEME_PLACEHOLDER=SAFETWITCH_DEFAULT_THEME_PLACEHOLDER
|
||||
export SAFETWITCH_DEFAULT_LOCALE_PLACEHOLDER=SAFETWITCH_DEFAULT_LOCALE_PLACEHOLDER
|
||||
export SAFETWITCH_FALLBACK_LOCALE_PLACEHOLDER=SAFETWITCH_FALLBACK_LOCALE_PLACEHOLDER
|
||||
fi
|
||||
|
||||
# Replace env vars in files served by NGINX
|
||||
|
@ -20,6 +22,8 @@ do
|
|||
sed -i 's|'${SAFETWITCH_INSTANCE_DOMAIN_PLACEHOLDER}'|'${SAFETWITCH_INSTANCE_DOMAIN}'|g' $file
|
||||
sed -i 's|'${SAFETWITCH_HTTPS_PLACEHOLDER}'|'${SAFETWITCH_HTTPS}'|g' $file
|
||||
sed -i 's|'${SAFETWITCH_DEFAULT_THEME_PLACEHOLDER}'|'${SAFETWITCH_DEFAULT_THEME}'|g' $file
|
||||
sed -i 's|'${SAFETWITCH_DEFAULT_LOCALE_PLACEHOLDER}'|'${SAFETWITCH_DEFAULT_LOCALE}'|g' $file
|
||||
sed -i 's|'${SAFETWITCH_FALLBACK_LOCALE_PLACEHOLDER}'|'${SAFETWITCH_FALLBACK_LOCALE}'|g' $file
|
||||
# Your other variables here...
|
||||
done
|
||||
|
||||
|
@ -28,6 +32,8 @@ echo -e "SAFETWITCH_BACKEND_DOMAIN_PLACEHOLDER=${SAFETWITCH_BACKEND_DOMAIN}" > .
|
|||
echo -e "SAFETWITCH_INSTANCE_DOMAIN_PLACEHOLDER=${SAFETWITCH_INSTANCE_DOMAIN}" >> .env.old
|
||||
echo -e "SAFETWITCH_HTTPS_PLACEHOLDER=${SAFETWITCH_HTTPS}" >> .env.old
|
||||
echo -e "SAFETWITCH_DEFAULT_THEME_PLACEHOLDER=${SAFETWITCH_DEFAULT_THEME}" >> .env.old
|
||||
echo -e "SAFETWITCH_DEFAULT_LOCALE_PLACEHOLDER=${SAFETWITCH_DEFAULT_LOCALE}" >> .env.old
|
||||
echo -e "SAFETWITCH_FALLBACK_LOCALE_PLACEHOLDER=${SAFETWITCH_FALLBACK_LOCALE}" >> .env.old
|
||||
|
||||
# Starting NGINX
|
||||
nginx -g 'daemon off;'
|
Loading…
Reference in a new issue