From ff0ea48aca05a3bb3e7f9bb85381e5f279352806 Mon Sep 17 00:00:00 2001 From: viktorstrate Date: Thu, 30 Apr 2020 14:59:29 +0200 Subject: [PATCH] Add defaults for more env variables in Dockerfile Add defaults for: - API_LISTEN_IP - API_LISTEN_PORT - SERVE_UI --- Dockerfile | 5 +++++ api/server.go | 4 ++++ docker-compose.example.yml | 1 - 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7ac98fd1..d8526bb0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,6 +33,11 @@ COPY --from=ui /app/dist /ui COPY --from=api /app/database/migrations /database/migrations COPY --from=api /app/photoview /app/photoview +ENV API_LISTEN_IP 127.0.0.1 +ENV API_LISTEN_PORT 80 + +ENV SERVE_UI 1 + EXPOSE 80 ENTRYPOINT ["/app/photoview"] diff --git a/api/server.go b/api/server.go index 834c89a6..f47dc871 100644 --- a/api/server.go +++ b/api/server.go @@ -96,6 +96,10 @@ func main() { log.Printf("Photoview API public endpoint ready at %s\n", apiEndpoint.String()) log.Printf("Photoview UI public endpoint ready at %s\n", uiEndpoint.String()) + if !shouldServeUI { + log.Printf("Notice: UI is not served by the the api (SERVE_UI=0)") + } + } log.Panic(http.ListenAndServe(":"+apiListenUrl.Port(), rootRouter)) diff --git a/docker-compose.example.yml b/docker-compose.example.yml index 2941431f..cb6d5e21 100644 --- a/docker-compose.example.yml +++ b/docker-compose.example.yml @@ -26,7 +26,6 @@ services: - API_LISTEN_IP=photoview - API_LISTEN_PORT=80 - PHOTO_CACHE=/app/cache - - SERVE_UI=1 # Change This: The publicly exposed url # For example if the server is available from the domain example.com,