Skip to content

Commit 930e0bb

Browse files
committed
Merge remote-tracking branch 'origin/feature/update-infrastructure-for-mono-repo' into feature/5402-build-pipeline-ghcr
# Conflicts: # CHANGELOG.md
2 parents 221877e + dc65882 commit 930e0bb

5 files changed

Lines changed: 152 additions & 8 deletions

File tree

.env

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
# Docker Compose project name (used as a prefix for container names in local dev).
12
COMPOSE_PROJECT_NAME=display
3+
# Hostname used by the local dev stack's reverse proxy.
24
COMPOSE_DOMAIN=display.local.itkdev.dk
5+
# itkdev-docker template identifier.
36
ITKDEV_TEMPLATE=symfony-6
47

58
# In all environments, the following files are loaded if they exist,
@@ -18,12 +21,16 @@ ITKDEV_TEMPLATE=symfony-6
1821
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
1922

2023
###> symfony/framework-bundle ###
24+
# Application environment (prod, dev, test). Override to 'prod' in .env.local on production hosts.
2125
APP_ENV=dev
26+
# Secret key used for encryption and security-related operations (MUST BE CHANGED in .env.local for production).
2227
APP_SECRET=CHANGE_ME
28+
# Comma-separated list of trusted proxy IPs for handling X-Forwarded headers.
2329
TRUSTED_PROXIES=127.0.0.1,REMOTE_ADDR
2430
###< symfony/framework-bundle ###
2531

2632
###> doctrine/doctrine-bundle ###
33+
# Database connection string for MariaDB/MySQL.
2734
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
2835
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
2936
#
@@ -33,105 +40,157 @@ DATABASE_URL="mysql://db:db@mariadb:3306/db?serverVersion=10.11.5-MariaDB"
3340
###< doctrine/doctrine-bundle ###
3441

3542
###> nelmio/cors-bundle ###
36-
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
43+
# Regular expression defining allowed origins for CORS requests.
3744
# Add allowed urls to .env.local as regex.
3845
# For development use:
3946
# CORS_ALLOW_ORIGIN="^.*"
47+
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
4048
###< nelmio/cors-bundle ###
4149

4250
###> lexik/jwt-authentication-bundle ###
51+
# Path to JWT private key file for signing tokens.
4352
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
53+
# Path to JWT public key file for verifying tokens.
4454
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
55+
# Passphrase for JWT private key (MUST BE CHANGED in .env.local for production).
4556
JWT_PASSPHRASE=CHANGE_ME
46-
# Default: 1 hour
57+
# Time-to-live in seconds for JWT access tokens. Default: 3600 (1 hour).
4758
JWT_TOKEN_TTL=3600
48-
# Default: 15 days
59+
# Time-to-live in seconds for screen JWT tokens. Default: 1296000 (15 days).
4960
JWT_SCREEN_TOKEN_TTL=1296000
5061
###< lexik/jwt-authentication-bundle ###
5162

5263
###> gesdinet/jwt-refresh-token-bundle ###
53-
# Default: 2 hours
64+
# Time-to-live in seconds for JWT refresh tokens. Default: 7200 (2 hours).
5465
JWT_REFRESH_TOKEN_TTL=7200
55-
# Default: 30 days
66+
# Time-to-live in seconds for screen JWT refresh tokens. Default: 2592000 (30 days).
5667
JWT_SCREEN_REFRESH_TOKEN_TTL=2592000
5768
###< gesdinet/jwt-refresh-token-bundle ###
5869

5970
###> redis ###
71+
# Prefix for Redis cache keys to avoid collisions across applications sharing a Redis instance.
6072
REDIS_CACHE_PREFIX=DisplayApiService
73+
# Connection string for Redis cache server.
6174
REDIS_CACHE_DSN=redis://redis:6379/0
6275
###< redis ###
6376

6477
###> Http Client ###
78+
# Maximum time in seconds the HTTP client waits for a connection.
6579
HTTP_CLIENT_TIMEOUT=5
80+
# Maximum total duration in seconds for an HTTP request including transfer.
6681
HTTP_CLIENT_MAX_DURATION=30
82+
# Log level for outgoing HTTP requests (debug, info, notice, warning, error).
6783
HTTP_CLIENT_LOG_LEVEL=error
6884
###< Http Client ###
6985

7086
###> App ###
87+
# Default date format for API responses (ISO 8601 with milliseconds).
7188
DEFAULT_DATE_FORMAT='Y-m-d\TH:i:s.v\Z'
89+
# Time interval for activation code expiration (ISO 8601 duration format, P2D = 2 days).
7290
ACTIVATION_CODE_EXPIRE_INTERVAL=P2D
91+
# Source for key vault configuration (ENVIRONMENT, FILE, etc.).
7392
KEY_VAULT_SOURCE=ENVIRONMENT
93+
# JSON configuration for key vault when using ENVIRONMENT source.
7494
KEY_VAULT_JSON="{}"
95+
# Enable tracking of screen information and statistics.
7596
TRACK_SCREEN_INFO=false
97+
# Interval in seconds between screen info updates.
7698
TRACK_SCREEN_INFO_UPDATE_INTERVAL_SECONDS=300
99+
# Toggle the relations checksum optimisation for content updates.
77100
RELATIONS_CHECKSUM_ENABLED=true
78101
###< App ###
79102

80103
###> itk-dev/openid-connect-bundle ###
81104
# See docs/feed/openid-connect.md for variable explanations.
82-
# internal provider
105+
# internal provider (admin login)
106+
# URL to OIDC provider's metadata/discovery endpoint.
83107
INTERNAL_OIDC_METADATA_URL=INTERNAL_OIDC_METADATA_URL
108+
# Client ID registered with the OIDC provider.
84109
INTERNAL_OIDC_CLIENT_ID=INTERNAL_OIDC_CLIENT_ID
110+
# Client secret for authentication with the OIDC provider.
85111
INTERNAL_OIDC_CLIENT_SECRET=INTERNAL_OIDC_CLIENT_SECRET
112+
# Redirect URI for OIDC callback after authentication.
86113
INTERNAL_OIDC_REDIRECT_URI=INTERNAL_OIDC_REDIRECT_URI
114+
# Leeway time in seconds for token validation clock skew tolerance.
87115
INTERNAL_OIDC_LEEWAY=30
116+
# Name of the claim containing user's name.
88117
INTERNAL_OIDC_CLAIM_NAME=navn
118+
# Name of the claim containing user's email.
89119
INTERNAL_OIDC_CLAIM_EMAIL=email
120+
# Name of the claim containing user's group memberships.
90121
INTERNAL_OIDC_CLAIM_GROUPS=groups
91122

92-
# external provider
123+
# external provider (citizen login)
124+
# URL to external OIDC provider's metadata/discovery endpoint.
93125
EXTERNAL_OIDC_METADATA_URL=EXTERNAL_OIDC_METADATA_URL
126+
# Client ID registered with the external OIDC provider.
94127
EXTERNAL_OIDC_CLIENT_ID=EXTERNAL_OIDC_CLIENT_ID
128+
# Client secret for authentication with the external OIDC provider.
95129
EXTERNAL_OIDC_CLIENT_SECRET=EXTERNAL_OIDC_CLIENT_SECRET
130+
# Redirect URI for external OIDC callback after authentication.
96131
EXTERNAL_OIDC_REDIRECT_URI=EXTERNAL_OIDC_REDIRECT_URI
132+
# Leeway time in seconds for external token validation clock skew tolerance.
97133
EXTERNAL_OIDC_LEEWAY=30
134+
# Salt used for hashing external OIDC user identifiers.
98135
EXTERNAL_OIDC_HASH_SALT=
136+
# Name of the claim containing user's sign-in identifier.
99137
EXTERNAL_OIDC_CLAIM_ID=signinname
100138

101-
# cli redirect url
139+
# Redirect URI for CLI-based OIDC authentication flow.
102140
OIDC_CLI_REDIRECT=APP_CLI_REDIRECT_URI
103141
###< itk-dev/openid-connect-bundle ###
104142

105143
###> Calendar Api Feed Source ###
106144
# See docs/feed/calendar-api-feed.md for variable explanations.
145+
# API endpoint for calendar location data.
107146
CALENDAR_API_FEED_SOURCE_LOCATION_ENDPOINT=
147+
# API endpoint for calendar resource data.
108148
CALENDAR_API_FEED_SOURCE_RESOURCE_ENDPOINT=
149+
# API endpoint for calendar event data.
109150
CALENDAR_API_FEED_SOURCE_EVENT_ENDPOINT=
151+
# JSON object for custom field mappings in calendar feeds.
110152
CALENDAR_API_FEED_SOURCE_CUSTOM_MAPPINGS='{}'
153+
# JSON object for modifying calendar event data.
111154
CALENDAR_API_FEED_SOURCE_EVENT_MODIFIERS='{}'
155+
# Date format used by the calendar API source.
112156
CALENDAR_API_FEED_SOURCE_DATE_FORMAT=
157+
# Timezone used by the calendar API source.
113158
CALENDAR_API_FEED_SOURCE_DATE_TIMEZONE=
159+
# Cache expiration time in seconds for calendar feed data.
114160
CALENDAR_API_FEED_SOURCE_CACHE_EXPIRE_SECONDS=300
115161
###< Calendar Api Feed Source ###
116162

117163
###> Event Database Api V2 Feed Type ###
164+
# Cache expiration time in seconds for event database API v2 responses.
118165
EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS=300
119166
###< Event Database Api V2 Feed Type ###
120167

121168
###> Admin configuration ###
169+
# API key for Rejseplanen (Danish journey planner) integration.
122170
ADMIN_REJSEPLANEN_APIKEY=
171+
# Enable display of screen online/offline status in admin interface.
123172
ADMIN_SHOW_SCREEN_STATUS=false
173+
# Enable touch button regions feature in admin interface.
124174
ADMIN_TOUCH_BUTTON_REGIONS=false
175+
# JSON array defining available login methods for admin interface.
125176
ADMIN_LOGIN_METHODS='[{"type":"username-password","enabled":true,"provider":"username-password","label":""}]'
177+
# Enable enhanced preview mode with additional features.
126178
ADMIN_ENHANCED_PREVIEW=false
127179
###< Admin configuration ###
128180

129181
###> Client configuration ###
182+
# Timeout in milliseconds for checking login status.
130183
CLIENT_LOGIN_CHECK_TIMEOUT=20000
184+
# Timeout in milliseconds before attempting to refresh authentication token. 300000 = 5 minutes.
131185
CLIENT_REFRESH_TOKEN_TIMEOUT=300000
186+
# Interval in milliseconds for checking release timestamp updates. 600000 = 10 minutes.
132187
CLIENT_RELEASE_TIMESTAMP_INTERVAL_TIMEOUT=600000
188+
# Interval in milliseconds for running content scheduling checks. 60000 = 1 minute.
133189
CLIENT_SCHEDULING_INTERVAL=60000
190+
# Interval in milliseconds for pulling new content from server. 90000 = 1.5 minutes.
134191
CLIENT_PULL_STRATEGY_INTERVAL=90000
192+
# JSON configuration for client color scheme with location coordinates.
135193
CLIENT_COLOR_SCHEME='{"type":"library","lat":56.0,"lng":10.0}'
194+
# Enable debug mode for client-side logging and diagnostics.
136195
CLIENT_DEBUG=false
137196
###< Client configuration ###
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
on:
3+
push:
4+
branches:
5+
- develop
6+
pull_request:
7+
8+
name: Env coverage
9+
10+
jobs:
11+
env-coverage:
12+
name: Validate env documentation coverage
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
17+
- name: Install task
18+
uses: go-task/setup-task@v2
19+
with:
20+
version: 3.x
21+
22+
- name: Run coding-standards:env:check
23+
run: task coding-standards:env:check

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ All notable changes to this project will be documented in this file.
3737
- Added vitest for frontend unit tests.
3838
- Updated infrastructure and image build for mono-repo.
3939
- Fixed nginx static-file location to fall back to PHP so LiipImagineBundle can generate missing thumbnails (#370).
40+
- Annotated `.env` so it serves as the canonical, self-documenting Symfony
41+
env example, with a CI check that enforces it stays in sync with `config/`.
4042
- Switched image build pipeline to GHCR with multi-arch layer caching.
4143

4244
### NB! Prior to 3.x the project was split into separate repositories

Taskfile.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ tasks:
108108
- task coding-standards:php:check
109109
- task coding-standards:markdown:check
110110
- task coding-standards:yml:check
111+
- task coding-standards:env:check
111112

112113
coding-standards:apply:
113114
desc: "Apply coding standards."
@@ -128,6 +129,11 @@ tasks:
128129
cmds:
129130
- docker compose run --rm --volume "$PWD:/md" prettier '**/*.{yml,yaml}' --check
130131

132+
coding-standards:env:check:
133+
desc: Validate that every Symfony env variable in config/ is documented in .env.
134+
cmds:
135+
- sh scripts/check-env-coverage.sh
136+
131137
coding-standards:assets:apply:
132138
desc: Apply coding standards for assets
133139
cmds:

scripts/check-env-coverage.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/sh
2+
# Validate that .env documents every Symfony env variable consumed in config/:
3+
# 1. Every %env(...)% read in config/ is declared in .env.
4+
# 2. Every variable in .env has a preceding description comment.
5+
set -e
6+
7+
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
8+
cd "$REPO_ROOT"
9+
10+
# Vars consumed via %env() but intentionally not part of the .env contract
11+
# (e.g. injected by tooling, not Symfony-defined defaults).
12+
ALLOW_LIST="VAR_DUMPER_SERVER"
13+
14+
failed=0
15+
tmp=$(mktemp -d)
16+
trap 'rm -rf "$tmp"' EXIT
17+
18+
# Check 1 — every %env(...)% read in config/ is declared in .env
19+
grep -rhoE '%env\(([a-z]+:)*[A-Z_][A-Z0-9_]*\)%' config/ \
20+
| sed -E 's/%env\(([a-z]+:)*([A-Z_][A-Z0-9_]*)\)%/\2/' \
21+
| sort -u > "$tmp/symfony-reads"
22+
grep -E '^[A-Z_][A-Z0-9_]*=' .env | cut -d= -f1 | sort -u > "$tmp/env-declares"
23+
echo "$ALLOW_LIST" | tr ' ' '\n' | sort -u > "$tmp/allow"
24+
25+
undocumented=$(comm -23 "$tmp/symfony-reads" "$tmp/env-declares" | comm -23 - "$tmp/allow")
26+
if [ -n "$undocumented" ]; then
27+
echo "FAIL: %env(...)% reads in config/ not declared in .env:"
28+
echo "$undocumented" | sed 's/^/ /'
29+
failed=1
30+
fi
31+
32+
# Check 2 — every variable in .env has a preceding description comment
33+
unannotated=$(awk '
34+
# Order matters: ### must be tested before # so recipe markers are not
35+
# treated as descriptions.
36+
/^###/ { last_was_comment = 0; next }
37+
/^#/ { last_was_comment = 1; next }
38+
/^$/ { last_was_comment = 0; next }
39+
/^[A-Z_][A-Z0-9_]*=/ {
40+
name = $0; sub("=.*", "", name)
41+
if (!last_was_comment) print name
42+
last_was_comment = 0
43+
}
44+
' .env)
45+
if [ -n "$unannotated" ]; then
46+
echo "FAIL: variables in .env without preceding description:"
47+
echo "$unannotated" | sed 's/^/ /'
48+
failed=1
49+
fi
50+
51+
if [ "$failed" -eq 0 ]; then
52+
echo "PASS: env coverage OK"
53+
fi
54+
exit "$failed"

0 commit comments

Comments
 (0)