Skip to content
Snippets Groups Projects
Commit c7ef2c1a authored by Pierre Ozoux's avatar Pierre Ozoux
Browse files

feat: automatize secret creation

parent ba79d695
No related branches found
No related tags found
No related merge requests found
#!/bin/bash -eu
source /etc/env
SERVER_NAME=$(gum input --placeholder "Server name - example.org")
OIDC_CLIENT_SECRET=$(gum input --placeholder "Oidc client secret - synapse to create in keycloak")
NS=${SERVER_NAME/./-}
kubectl create ns ${NS}
SMTP_SECRET=$(gum input --placeholder "Smtp secret - on pm1 - kubectl -n ${NS} get secrets ${NS}-smtp -o json | jq -r ".data.password" | base64 -d")
S3_SECRET_KEY=$(gum input --placeholder "S3 Secret Key for dumps - on pm1 - kubectl -n ${NS} get secrets ${NS}-dumps -o json | jq -r ".data.AWS_SECRET_ACCESS_KEY" | base64 -d")
MACAROON_SECRET=$(base64 /dev/urandom | head -c 32)
REDIS_SECRET=$(base64 /dev/urandom | head -c 32)
cat << EOF > matrix.yml
cat << EOF > matrix-secret.yml
---
apiVersion: v1
kind: Secret
......@@ -19,13 +26,13 @@ stringData:
SERVER_NAME: "$SERVER_NAME"
ELEMENT_SUBDOMAIN: "chat"
S3_BUCKET: "$NS-dumps"
S3_SECRET_KEY: ""
TURN_SECRET: ""
S3_SECRET_KEY: "$S3_SECRET_KEY"
TURN_SECRET: "$TURN_SECRET"
MACAROON_SECRET: "$MACAROON_SECRET"
SMTP_USER_FROM: "$NS@liiib.re"
SMTP_SECRET: ""
SMTP_SECRET: "$SMTP_SECRET"
OIDC_ISSUER: "https://id.$SERVER_NAME/auth/realms/$NS"
CLIENT_SECRET: ""
CLIENT_SECRET: "$OIDC_CLIENT_SECRET"
REDIS_SECRET: "$REDIS_SECRET"
USER_DIRECTORY_SEARCH_ALL: "false"
HOME_URL: "https://nuage.$SERVER_NAME"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment