Skip to content

Commit 4779ba8

Browse files
committed
refactor(config): use Symfony dotenv for LDAP config
Remove LDAP environment variable passing from Docker Compose. App now reads LDAP config directly from .env files via Symfony dotenv chain: .env -> .env.local -> .env.{APP_ENV} -> .env.{APP_ENV}.local Also fixed ldap-dev container startup by copying LDIF file instead of bind-mounting (container needs to delete file after processing).
1 parent 2e55983 commit 4779ba8

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

compose.yml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ services:
2525
- production
2626

2727
# Development app service with dev tools (includes databases)
28+
# LDAP and other config read from .env files (Symfony dotenv)
2829
app-dev:
2930
build:
3031
context: .
@@ -36,14 +37,6 @@ services:
3637
- APP_DEBUG=1
3738
- TRUSTED_PROXY_ALL
3839
- TRUSTED_PROXY_LIST
39-
- LDAP_HOST=${LDAP_HOST:-ldap-dev}
40-
- LDAP_PORT=${LDAP_PORT:-389}
41-
- LDAP_READUSER=${LDAP_READUSER:-cn=readuser,dc=dev,dc=local}
42-
- LDAP_READPASS=${LDAP_READPASS:-readuser}
43-
- LDAP_BASEDN=${LDAP_BASEDN:-dc=dev,dc=local}
44-
- LDAP_USERNAMEFIELD=${LDAP_USERNAMEFIELD:-uid}
45-
- LDAP_USESSL=${LDAP_USESSL:-false}
46-
- LDAP_CREATE_USER=${LDAP_CREATE_USER:-true}
4740
volumes:
4841
# Development volumes (bind mounts for live editing)
4942
- .:/var/www/html
@@ -55,10 +48,9 @@ services:
5548
- db
5649
- db-test
5750
restart: "no"
58-
profiles:
51+
profiles:
5952
- dev
6053
- development
61-
- test
6254

6355
# Development tools service (static analysis, linting - no DB dependencies)
6456
app-tools:
@@ -95,7 +87,7 @@ services:
9587
- prod
9688
- production
9789

98-
# Development web server
90+
# Development web server
9991
httpd-dev:
10092
image: nginx:alpine
10193
volumes:
@@ -106,10 +98,9 @@ services:
10698
restart: "no"
10799
ports:
108100
- ${HTTP_PORT:-8765}:80
109-
profiles:
101+
profiles:
110102
- dev
111103
- development
112-
- test
113104

114105
# Production database
115106
db:
@@ -123,7 +114,7 @@ services:
123114
- db-data:/var/lib/mysql
124115
- ./sql/full.sql:/docker-entrypoint-initdb.d/001_full.sql
125116
restart: always
126-
profiles:
117+
profiles:
127118
- prod
128119
- production
129120
- dev
@@ -183,15 +174,18 @@ services:
183174
- LDAP_READONLY_USER=true
184175
- LDAP_READONLY_USER_USERNAME=readuser
185176
- LDAP_READONLY_USER_PASSWORD=readuser
177+
# Keep bootstrap files instead of deleting them after processing
178+
- LDAP_REMOVE_CONFIG_AFTER_SETUP=false
186179
volumes:
187180
- ldap-dev-data:/var/lib/ldap
188181
- ldap-dev-config:/etc/ldap/slapd.d
189-
# Bootstrap LDIF for dev users (loaded on first container start)
190-
- ./docker/ldap/users-only.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/users.ldif:ro
182+
# Copy LDIF to a directory that allows modification (use entrypoint to copy)
183+
- ./docker/ldap/users-only.ldif:/ldif-source/users.ldif:ro
184+
entrypoint: ["/bin/bash", "-c", "cp /ldif-source/users.ldif /container/service/slapd/assets/config/bootstrap/ldif/custom/users.ldif 2>/dev/null || true && exec /container/tool/run"]
191185
ports:
192186
- "3389:389"
193187
restart: "no"
194-
profiles:
188+
profiles:
195189
- dev
196190
- development
197191
- test

0 commit comments

Comments
 (0)