Skip to content

Commit

Permalink
[#385] Unify placeholder usage in configuration templates
Browse files Browse the repository at this point in the history
Standardized the format of placeholders within template files across the
deployment setup to improve the consistency and reliability of dynamic
configuration generation. Modified `config.mk`,
`backend-config.json.tpl`, and
`grafana-provisioning/alerting/alerting.yml` to use a uniform
placeholder notation, enclosed in angle brackets (e.g.,
`<PLACEHOLDER>`), for all configurable values. This refinement
simplifies the template processing logic, ensuring a more streamlined
and error-free substitution of environment-specific values during the
deployment process, thereby enhancing the overall maintainability of the
deployment infrastructure.
  • Loading branch information
placek committed Mar 5, 2024
1 parent 1659908 commit 82d3bca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions scripts/govtool/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ prepare-dbsync-secrets:

.PHONY: prepare-backend-config
prepare-backend-config:
sed -e "s/DBSYNC_POSTGRES_DB/$${DBSYNC_POSTGRES_DB}/" \
-e "s/DBSYNC_POSTGRES_USER/$${DBSYNC_POSTGRES_USER}/" \
-e "s/DBSYNC_POSTGRES_PASSWORD/$${DBSYNC_POSTGRES_PASSWORD}/" \
-e "s|SENTRY_DSN|$${SENTRY_DSN_BACKEND}|" \
sed -e "s|<DBSYNC_POSTGRES_DB>|$${DBSYNC_POSTGRES_DB}|" \
-e "s|<DBSYNC_POSTGRES_USER>|$${DBSYNC_POSTGRES_USER}|" \
-e "s|<DBSYNC_POSTGRES_PASSWORD>|$${DBSYNC_POSTGRES_PASSWORD}|" \
-e "s|<SENTRY_DSN>|$${SENTRY_DSN_BACKEND}|" \
"$(config_dir)/templates/backend-config.json.tpl" \
> "$(target_config_dir)/backend-config.json"

Expand All @@ -72,8 +72,8 @@ prepare-prometheus-config:
prepare-grafana-provisioning:
mkdir -p $(grafana_provisioning_dir)
cp -a $(template_config_dir)/grafana-provisioning/* $(grafana_provisioning_dir)
sed -e "s/GRAFANA_SLACK_RECIPIENT/$${GRAFANA_SLACK_RECIPIENT}/" \
-e "s|GRAFANA_SLACK_OAUTH_TOKEN|$${GRAFANA_SLACK_OAUTH_TOKEN}|" \
sed -e "s|<GRAFANA_SLACK_RECIPIENT>|$${GRAFANA_SLACK_RECIPIENT}|" \
-e "s|<GRAFANA_SLACK_OAUTH_TOKEN>|$${GRAFANA_SLACK_OAUTH_TOKEN}|" \
-i $(grafana_provisioning_dir)/alerting/alerting.yml

.PHONY: prepare-nginx-config
Expand Down
8 changes: 4 additions & 4 deletions scripts/govtool/config/templates/backend-config.json.tpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"dbsyncconfig" : {
"host" : "postgres",
"dbname" : "DBSYNC_POSTGRES_DB",
"user" : "DBSYNC_POSTGRES_USER",
"password" : "DBSYNC_POSTGRES_PASSWORD",
"dbname" : "<DBSYNC_POSTGRES_DB>",
"user" : "<DBSYNC_POSTGRES_USER>",
"password" : "<DBSYNC_POSTGRES_PASSWORD>",
"port" : 5432
},
"port" : 9876,
"host" : "0.0.0.0",
"cachedurationseconds": 20,
"sentrydsn": "SENTRY_DSN"
"sentrydsn": "<SENTRY_DSN>"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ contactPoints:
name: Slack GovTool
type: slack
settings:
recipient: GRAFANA_SLACK_RECIPIENT
token: GRAFANA_SLACK_OAUTH_TOKEN
recipient: <GRAFANA_SLACK_RECIPIENT>
token: <GRAFANA_SLACK_OAUTH_TOKEN>
disableResolveMessage: false

policies:
Expand Down

0 comments on commit 82d3bca

Please sign in to comment.