Browse Source

new: [keycloak] add relation with postgres

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
nj-keycloak-17.0
Valentin Lab 3 years ago
parent
commit
bea0309547
  1. 18
      keycloak/hooks/postgres_database-relation-joined
  2. 8
      keycloak/metadata.yml

18
keycloak/hooks/postgres_database-relation-joined

@ -0,0 +1,18 @@
#!/bin/bash
set -e
PASSWORD="$(relation-get password)"
USER="$(relation-get user)"
DBNAME="$(relation-get dbname)"
config-add "\
services:
$MASTER_BASE_SERVICE_NAME:
environment:
DB_VENDOR: postgres
DB_ADDR: \"$MASTER_TARGET_SERVICE_NAME\"
DB_DATABASE: \"$DBNAME\"
DB_PASSWORD: \"$PASSWORD\"
DB_USER: \"$USER\"
"

8
keycloak/metadata.yml

@ -12,3 +12,11 @@ uses:
proxy: "Public access"
default-options:
target: !var-expand ${MASTER_BASE_SERVICE_NAME}:8080
postgres-database:
#constraint: required | recommended | optional
#auto: pair | summon | none ## default: pair
constraint: required
auto: summon
solves:
database: "main storage"
default-options:
Loading…
Cancel
Save