Skip to content

Commit 61f8abd

Browse files
committed
refactor: specify env variables as an object rather than as a list
1 parent 029d4fa commit 61f8abd

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

infra/docker/postgres.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ services:
1111
web:
1212
environment:
1313
# NOTE: it's better to have credentials the same as in src/main/resources/application-postgres.properties
14-
- SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/mystamps
15-
- SPRING_DATASOURCE_USERNAME=mystamps
16-
- SPRING_DATASOURCE_PASSWORD=secret
17-
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver
14+
SPRING_DATASOURCE_URL: jdbc:postgresql://db:5432/mystamps
15+
SPRING_DATASOURCE_USERNAME: mystamps
16+
SPRING_DATASOURCE_PASSWORD: secret
17+
SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver
1818
# to test whether it works in prod-like environment
19-
#- SPRING_LIQUIBASE_CONTEXTS=scheme,init-data,prod-data
19+
#SPRING_LIQUIBASE_CONTEXTS: scheme,init-data,prod-data
2020
#volumes:
2121
# to use a WAR file from filesystem and avoid to build an image every time
2222
#- ../../target/mystamps.war:/data/mystamps/mystamps.war:ro
@@ -31,9 +31,9 @@ services:
3131
image: postgres:11.3
3232
environment:
3333
# NOTE: it's better to have credentials the same as in .github/workflows/integration-tests-postgres.yml
34-
- POSTGRES_USER=mystamps
35-
- POSTGRES_PASSWORD=secret
36-
- POSTGRES_DATABASE=mystamps
34+
POSTGRES_USER: mystamps
35+
POSTGRES_PASSWORD: secret
36+
POSTGRES_DATABASE: mystamps
3737
networks:
3838
- internal-network
3939

infra/docker/prod.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
services:
99
web:
1010
environment:
11-
- SPRING_PROFILES_ACTIVE=prod
11+
SPRING_PROFILES_ACTIVE: prod
1212
# localhost -> db
13-
- SPRING_DATASOURCE_URL=jdbc:mysql://db:3306/mystamps?logger=com.mysql.jdbc.log.Slf4JLogger&useSSL=false&logSlowQueries=true&slowQueryThresholdMillis=250&autoSlowLog=false&characterEncoding=UTF-8
13+
SPRING_DATASOURCE_URL: jdbc:mysql://db:3306/mystamps?logger=com.mysql.jdbc.log.Slf4JLogger&useSSL=false&logSlowQueries=true&slowQueryThresholdMillis=250&autoSlowLog=false&characterEncoding=UTF-8
1414
# override password from application-prod.properties to be the same as in db
15-
- SPRING_DATASOURCE_PASSWORD=secret
15+
SPRING_DATASOURCE_PASSWORD: secret
1616
# only for testing locally. See also: https://github.com/php-coder/mystamps/issues/670
17-
- SERVER_SERVLET_SESSION_COOKIE_SECURE=false
17+
SERVER_SERVLET_SESSION_COOKIE_SECURE: false
1818
volumes:
1919
- ./application-prod.properties:/data/mystamps/application-prod.properties:ro
2020
networks:
@@ -34,12 +34,12 @@ services:
3434
#
3535
# Example:
3636
# docker exec -it mystamps_db_1 mysql -u mystamps mystamps -psecret -e 'show tables'
37-
- MYSQL_RANDOM_ROOT_PASSWORD=true
38-
- MYSQL_USER=mystamps
37+
MYSQL_RANDOM_ROOT_PASSWORD: true
38+
MYSQL_USER: mystamps
3939
# FIXME: try to use a secret
40-
- MYSQL_PASSWORD=secret
40+
MYSQL_PASSWORD: secret
4141
# the user specified above will be granted superuser access automatically
42-
- MYSQL_DATABASE=mystamps
42+
MYSQL_DATABASE: mystamps
4343
ports:
4444
- '3306:3306'
4545
networks:

0 commit comments

Comments
 (0)