Skip to content

Commit 55d8b10

Browse files
authored
Use app.constants.template file for container env customization (#1901)
* Replace sed with dedicated app.constants.template * Use sed for version * Fully specify dockerignore path
1 parent 71a6f18 commit 55d8b10

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Generated dynamically using a template to support environment variables
2+
src/ServicePulse.Host/app/js/app.constants.js

src/Container/Dockerfile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,12 @@ LABEL org.opencontainers.image.title="ServicePulse" \
2323
ENV SERVICECONTROL_URL="http://localhost:33333/api/"
2424
ENV MONITORING_URLS="['http://localhost:33633/']"
2525
ENV DEFAULT_ROUTE="/dashboard"
26+
ENV SHOW_PENDING_RETRY="false"
2627

2728
COPY /src/ServicePulse.Host/app /usr/share/nginx/html
29+
ADD /src/Container/app.constants.template /usr/share/nginx/html/js/app.constants.template
2830

29-
RUN mv /usr/share/nginx/html/js/app.constants.js /usr/share/nginx/html/js/app.constants.template &&\
30-
sed -i \
31-
-e "s,http://localhost:33333/api/,\$SERVICECONTROL_URL,g" \
32-
-e "s,\['http://localhost:33633/'\],\$MONITORING_URLS,g" \
33-
-e "s,/dashboard,\$DEFAULT_ROUTE,g" \
34-
/usr/share/nginx/html/js/app.constants.template
31+
RUN sed -i -e "s,__VERSION__,$VERSION,g" /usr/share/nginx/html/js/app.constants.template
3532

3633
ADD /src/Container/nginx.conf /etc/nginx/
3734
ADD --chown=root:root --chmod=755 /src/Container/updateconstants.sh /docker-entrypoint.d/40-update-servicepulse-constants.sh

src/Container/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ docker run -p 9090:90 particular/servicepulse:latest
1515
- **`SERVICECONTROL_URL`**: _Default_: `http://localhost:33333/api/`. The url to your ServiceControl instance
1616
- **`MONITORING_URLS`**: _Default_: `['http://localhost:33633/']`. A JSON array of URLs to your monitoring instances
1717
- **`DEFAULT_ROUTE`**: _Default_: `/dashboard`. The default page that should be displayed when visiting the site
18+
- **`SHOW_PENDING_RETRY`** _Default_: `false`. Set to `true` to show details of pending retries
1819

1920
It may be desireable to run the ServiceControl services in an isolated network. When doing so ServicePulse must be configured to connect to those services using environment variables:
2021

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
window.defaultConfig = {
2+
default_route: '$DEFAULT_ROUTE',
3+
version: '__VERSION__',
4+
service_control_url: '$SERVICECONTROL_URL',
5+
monitoring_urls: $MONITORING_URLS,
6+
showPendingRetry: $SHOW_PENDING_RETRY,
7+
};

0 commit comments

Comments
 (0)