Skip to content

Commit d405478

Browse files
committed
fix: replace hardcoded secrets with environment variables
- Replace hardcoded Redis password with REDIS_PASSWORD env var - Replace hardcoded JWT secret with JWT_SECRET env var - Update .env.example with placeholder values instead of 'secret' - Remove duplicate 'services:' key in docker-compose.yml
1 parent bdd335b commit d405478

3 files changed

Lines changed: 25 additions & 15 deletions

File tree

.env.example

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ API_URL=https://hejbit.local
55

66
POSTGRES_DB=swarmbox
77
POSTGRES_USER=swarmbox
8-
POSTGRES_PASSWORD=secret
8+
POSTGRES_PASSWORD=your_postgres_password_here
99

10-
NEXTCLOUD_ADMIN_USER=swarmbox
11-
NEXTCLOUD_ADMIN_PASSWORD=swarmbox
10+
REDIS_PASSWORD=your_redis_password_here
11+
JWT_SECRET=your_jwt_secret_here
12+
13+
NEXTCLOUD_ADMIN_USER=admin
14+
NEXTCLOUD_ADMIN_PASSWORD=your_admin_password_here

docker-compose.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
# 127.0.0.1 adminer.hejbit.local
77
# 127.0.0.1 features.hejbit.local
88

9-
services:
10-
119
services:
1210
web:
1311
build: ./docker/web
@@ -81,8 +79,9 @@ services:
8179
# ports:
8280
# - '6379:6379'
8381
restart: unless-stopped
82+
command: redis-server --requirepass ${REDIS_PASSWORD:-secret}
8483
healthcheck:
85-
test: ["CMD", "redis-cli", "-a", "secret", "ping"]
84+
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD:-secret}", "ping"]
8685
start_period: 3s
8786
timeout: 5s
8887
interval: 30s
@@ -99,7 +98,16 @@ services:
9998
volumes:
10099
- nc-db:/var/lib/postgresql/data
101100
healthcheck:
102-
test: [ "CMD", "pg_isready", "-q", "-d", "${POSTGRES_DB}", "-U", "${POSTGRES_USER}" ]
101+
test:
102+
[
103+
"CMD",
104+
"pg_isready",
105+
"-q",
106+
"-d",
107+
"${POSTGRES_DB}",
108+
"-U",
109+
"${POSTGRES_USER}",
110+
]
103111
start_period: 3s
104112
timeout: 5s
105113
interval: 30s
@@ -141,7 +149,7 @@ services:
141149
condition: service_healthy
142150
labels:
143151
caddy: adminer.hejbit.local
144-
caddy.reverse_proxy: '{{upstreams 8080}}'
152+
caddy.reverse_proxy: "{{upstreams 8080}}"
145153
environment:
146154
ADMINER_DEFAULT_SERVER: postgres
147155

@@ -150,16 +158,16 @@ services:
150158
- feature
151159
image: ghcr.io/open-feature/flagd:latest
152160
restart: unless-stopped
153-
command: 'start --uri file:/etc/flagd/hejbit.flagd.json --cors-origin *'
161+
command: "start --uri file:/etc/flagd/hejbit.flagd.json --cors-origin *"
154162
# ports:
155163
# - '8013:8013'
156164
volumes:
157-
- './docker/flagd/hejbit.flagd.json:/etc/flagd/hejbit.flagd.json'
165+
- "./docker/flagd/hejbit.flagd.json:/etc/flagd/hejbit.flagd.json"
158166
networks:
159167
- proxy
160168
labels:
161169
caddy: features.hejbit.local
162-
caddy.reverse_proxy: '{{upstreams 8013}}'
170+
caddy.reverse_proxy: "{{upstreams 8013}}"
163171
depends_on:
164172
proxy:
165173
condition: service_healthy
@@ -170,7 +178,7 @@ services:
170178
image: onlyoffice/documentserver
171179
environment:
172180
JWT_ENABLED: true
173-
JWT_SECRET: secret
181+
JWT_SECRET: ${JWT_SECRET:-secret}
174182
JWT_HEADER: AuthorizationJwt
175183
JWT_IN_BODY: true
176184
USE_UNAUTHORIZED_STORAGE: true
@@ -187,7 +195,7 @@ services:
187195
- proxy
188196
labels:
189197
caddy: onlyoffice.local
190-
caddy.reverse_proxy: '{{upstreams 80}}'
198+
caddy.reverse_proxy: "{{upstreams 80}}"
191199
depends_on:
192200
proxy:
193201
condition: service_healthy
@@ -229,7 +237,6 @@ volumes:
229237
onlyoffice_lib:
230238
onlyoffice_logs:
231239

232-
233240
networks:
234241
frontend:
235242
backend:

docker/nextcloud/hooks/post-installation/003-install-onlyoffice.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ php occ config:app:set onlyoffice DocumentServerUrl --value="https://onlyoffice.
77
php occ config:app:set onlyoffice DocumentServerInternalUrl --value="https://onlyoffice.local/"
88
php occ config:app:set onlyoffice StorageUrl --value="https://nextcloud.local/"
99
php occ config:system:set onlyoffice verify_peer_off --value="true"
10-
php occ config:system:set onlyoffice jwt_secret --value="secret"
10+
php occ config:system:set onlyoffice jwt_secret --value="${JWT_SECRET:-secret}"
1111
php occ config:system:set onlyoffice jwt_header --value="AuthorizationJwt"

0 commit comments

Comments
 (0)