From 68beedb4c8ed96f034a4e98cbf568bc38246412b Mon Sep 17 00:00:00 2001 From: mattyl006 Date: Fri, 21 Oct 2022 12:31:55 +0200 Subject: [PATCH] env --- .env | 3 +++ README.md | 6 +++++- src/services/KeyCloakService.js | 18 +++--------------- 3 files changed, 11 insertions(+), 16 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..ea19c51 --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +KC_URL="https://auth-dev.csi.wmi.amu.edu.pl/" +KC_REALM="gonito-dev" +KC_CLIENT_ID="gonito-dev-heroku" diff --git a/README.md b/README.md index 79a9351..e51d4fa 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,8 @@ App will work on port 3001. ## Stop app -`docker-compose stop` \ No newline at end of file +`docker-compose stop` + +## Keycloak + +Set variables in *.env* to choose keycloak connect. \ No newline at end of file diff --git a/src/services/KeyCloakService.js b/src/services/KeyCloakService.js index 1dd0a13..67f9547 100644 --- a/src/services/KeyCloakService.js +++ b/src/services/KeyCloakService.js @@ -1,23 +1,11 @@ import Keycloak from 'keycloak-js'; -// const _kc = new Keycloak({ -// url: 'https://auth-dev.csi.wmi.amu.edu.pl/', -// realm: 'gonito-dev', -// clientId: 'gonito-dev-localhost' -// }); - const _kc = new Keycloak({ - url: 'https://auth-dev.csi.wmi.amu.edu.pl/', - realm: 'gonito-dev', - clientId: 'gonito-dev-heroku' + url: process.env.KC_URL, + realm: process.env.KC_REALM, + clientId: process.env.KC_CLIENT_ID }); -// const _kc = new Keycloak({ -// url: 'http://0.0.0.0:8080', -// realm: 'test', -// clientId: 'test' -// }); - const initKeycloak = (onAuthenticatedCallback) => { _kc.init({ onLoad: 'check-sso',