mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 01:20:24 +03:00
Allow Docker image to generate servers.json from environment
In the Docker image, generate the servers.json with a single server by reading environment variables.
This commit is contained in:
parent
d5530b4614
commit
ccffa0fe12
2 changed files with 17 additions and 0 deletions
|
@ -9,4 +9,5 @@ FROM nginx:1.19.6-alpine
|
|||
LABEL maintainer="Alejandro Celaya <alejandro@alejandrocelaya.com>"
|
||||
RUN rm -r /usr/share/nginx/html && rm /etc/nginx/conf.d/default.conf
|
||||
COPY config/docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY config/docker/servers.json_from_env.sh /docker-entrypoint.d/30-shlink-servers-json.sh
|
||||
COPY --from=node /shlink-web-client/build /usr/share/nginx/html
|
||||
|
|
16
config/docker/servers.json_from_env.sh
Executable file
16
config/docker/servers.json_from_env.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
ME=$(basename $0)
|
||||
|
||||
setup_single_shlink_server() {
|
||||
[ -n "$SHLINK_CLIENT_SERVER_URL" ] || return 0
|
||||
[ -n "$SHLINK_CLIENT_API_KEY" ] || return 0
|
||||
local name="${SHLINK_CLIENT_SERVER_NAME:-Shlink}"
|
||||
echo "[{\"name\":\"${name}\",\"url\":\"${SHLINK_CLIENT_SERVER_URL}\",\"apiKey\":\"${SHLINK_CLIENT_API_KEY}\"}]" > /usr/share/nginx/html/servers.json
|
||||
}
|
||||
|
||||
setup_single_shlink_server
|
||||
|
||||
exit 0
|
Loading…
Reference in a new issue