Skip to content

Commit

Permalink
inject api-db connection credentials via env variables (#1861)
Browse files Browse the repository at this point in the history
* inject api-db connection credentials via env variables
  • Loading branch information
Schnitzel authored May 9, 2020
1 parent e38818c commit 9867056
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
5 changes: 5 additions & 0 deletions services/ssh/.lagoon.app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ objects:
value: ${SERVICE_NAME}
- name: CRONJOBS
value: ${CRONJOBS}
- name: API_DB_PASSWORD
valueFrom:
secretKeyRef:
name: api-db-password
key: API_DB_PASSWORD
resources:
requests:
cpu: 10m
Expand Down
3 changes: 2 additions & 1 deletion services/ssh/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ RUN fix-permissions /home/grant.sh

RUN fix-permissions /etc/ssh/ && \
fix-permissions /run/ && \
fix-permissions /etc/libnss-mysql.cfg
fix-permissions /etc/libnss-mysql.cfg && \
fix-permissions /etc/libnss-mysql-root.cfg

RUN mkdir -p /var/run/sshd && chmod 700 /var/run/sshd

Expand Down
1 change: 1 addition & 0 deletions services/ssh/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ep /home/grant.sh
ep /home/token-debug.sh

ep /etc/libnss-mysql.cfg
ep /etc/libnss-mysql-root.cfg

# filling /authorize.env with all our current env variables, this file
# will be sourced by /authorize.sh in order to have all environment variables.
Expand Down
4 changes: 2 additions & 2 deletions services/ssh/etc/libnss-mysql-root.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
username api
password api
username ${API_DB_USERNAME:-api}
password ${API_DB_PASSWORD:-api}
8 changes: 4 additions & 4 deletions services/ssh/etc/libnss-mysql.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ getpwent SELECT openshift_project_name,'x','${USER_ID}','1000','Lagoon User',
getspent SELECT openshift_project_name,'x','1','0','99999','0','0','-1','0' \
FROM environment

host api-db
database infrastructure
username api
password api
host ${API_DB_HOST:-api-db}
database ${API_DB_DATABASE:-infrastructure}
username ${API_DB_USERNAME:-api}
password ${API_DB_PASSWORD:-api}

0 comments on commit 9867056

Please sign in to comment.