Skip to content

Commit

Permalink
feat: parameterise token endpoint (#12)
Browse files Browse the repository at this point in the history
* Parameterised token endpoint

* Bumped up the version
  • Loading branch information
vijayg10 authored Oct 21, 2021
1 parent 8932db1 commit dc21676
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ ENV LOGIN_URL=$LOGIN_URL
ARG LOGOUT_URL
ENV LOGOUT_URL=$LOGOUT_URL

ARG AUTH_TOKEN_ENDPOINT
ENV AUTH_TOKEN_ENDPOINT=$AUTH_TOKEN_ENDPOINT

ARG REMOTE_1_URL
ENV REMOTE_1_URL=$REMOTE_1_URL

Expand Down
13 changes: 7 additions & 6 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ services:
cache_from:
- mojaloop/reporting-hub-bop-shell
environment:
- AUTH_API_BASE_URL=/
- AUTH_MOCK_API=true
- REMOTE_API_BASE_URL=/
- REMOTE_MOCK_API=false
- LOGIN_URL=https://your-login-url
- LOGOUT_URL=https://your-logout-url
# - AUTH_API_BASE_URL=/api
- AUTH_MOCK_API=false
- REMOTE_API_BASE_URL=/remote
- REMOTE_MOCK_API=true
- LOGIN_URL=http://127.0.0.1:4433/self-service/login/browser
- LOGOUT_URL=http://127.0.0.1:4433/self-service/logout
- AUTH_ENABLED=true
- AUTH_TOKEN_ENDPOINT=http://127.0.0.1:4433/sessions/whoami
- REMOTE_1_URL=http://localhost:8081
- REMOTE_2_URL=http://localhost:8082
ports:
Expand Down
1 change: 1 addition & 0 deletions docker/createJSONConfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ echo "{
\"REMOTE_API_BASE_URL\": \"${REMOTE_API_BASE_URL}\",
\"REMOTE_MOCK_API\": \"${REMOTE_MOCK_API}\",
\"AUTH_ENABLED\": \"${AUTH_ENABLED}\",
\"AUTH_TOKEN_ENDPOINT\": \"${AUTH_TOKEN_ENDPOINT}\",
\"LOGIN_URL\": \"${LOGIN_URL}\",
\"LOGOUT_URL\": \"${LOGOUT_URL}\"
}" | jq '.' > /usr/share/nginx/html/config.json
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mojaloop/reporting-hub-bop-shell",
"version": "1.6.3",
"version": "1.6.4",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions src/Config/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default async (): Promise<AppConfig & AuthConfig & ApiConfig> => {
REMOTE_API_BASE_URL,
REMOTE_MOCK_API,
AUTH_ENABLED,
AUTH_TOKEN_ENDPOINT,
LOGIN_URL,
LOGOUT_URL,
} = await fetch(`${baseUrl}/config.json`).then((response) => response.json());
Expand Down Expand Up @@ -52,6 +53,9 @@ export default async (): Promise<AppConfig & AuthConfig & ApiConfig> => {
if (AUTH_ENABLED !== undefined) {
config.isAuthEnabled = AUTH_ENABLED !== 'false';
}
if (AUTH_TOKEN_ENDPOINT !== undefined) {
config.tokenEndpoint = AUTH_TOKEN_ENDPOINT;
}
} catch (err) {
// eslint-disable-next-line
console.info('config returned error', err);
Expand Down

0 comments on commit dc21676

Please sign in to comment.