From c0da0da439f89c54c0c102970879bd7bf03fbf2d Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Fri, 27 Dec 2024 13:10:03 +1100 Subject: [PATCH] chore: import keycloak-js --- Makefile | 27 +++++++++++++++++++++++++-- package.json | 1 + src/lib/withKeycloak.js | 1 + src/pages/_document.js | 1 - yarn.lock | 5 +++++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3c729690..a3e3c02b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # upstream CI_BUILD_TAG ?= lagoon-ui CORE_REPO=https://github.com/uselagoon/lagoon.git -CORE_TREEISH=main +CORE_TREEISH=keycloak-26 CYPRESS_BASE=cypress/base:20.13.1 LAGOON_CORE_IMAGE_REPO=testlagoon @@ -15,6 +15,15 @@ yarn-start-ui: && yarn build \ && yarn start \ +.PHONY: start +start: + export GRAPHQL_API=http://localhost:3000/graphql \ + && export KEYCLOAK_API=http://localhost:8088/auth \ + && export NODE_ENV=production \ + && export NODE_PORT=3003 \ + && export LAGOON_UI_TOURS_ENABLED=disabled \ + && docker compose -p $(CI_BUILD_TAG) --compatibility up --build -d ui + # run-cypress: .PHONY: start-ui start-ui: development-api @@ -59,4 +68,18 @@ development-api-down: .PHONY: down down: $(MAKE) development-api-down - docker compose -p $(CI_BUILD_TAG) --compatibility down -v --remove-orphans \ No newline at end of file + docker compose -p $(CI_BUILD_TAG) --compatibility down -v --remove-orphans + +.PHONY: local-dev-yarn +local-dev-yarn: + $(MAKE) local-dev-yarn-stop + docker run --name local-dev-yarn -d -v ${PWD}:/app uselagoon/node-20-builder + docker exec local-dev-yarn bash -c "yarn install --frozen-lockfile" + docker exec local-dev-yarn bash -c "yarn build" + docker exec -it local-dev-yarn bash + $(MAKE) local-dev-yarn-stop + +.PHONY: local-dev-yarn-stop +local-dev-yarn-stop: + docker stop local-dev-yarn || true + docker rm local-dev-yarn || true \ No newline at end of file diff --git a/package.json b/package.json index f4f5c168..a628be3a 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "graphql": "^16.8.1", "graphql-tag": "^2.10.0", "isomorphic-unfetch": "^4.0.2", + "keycloak-js": "^26.0.7", "moment": "^2.22.2", "moment-duration-format": "^2.2.2", "next": "^14.2.2", diff --git a/src/lib/withKeycloak.js b/src/lib/withKeycloak.js index 05b713b7..ded12d8f 100644 --- a/src/lib/withKeycloak.js +++ b/src/lib/withKeycloak.js @@ -2,6 +2,7 @@ import React from 'react'; import getConfig from 'next/config'; +import Keycloak from 'keycloak-js'; import { queryStringToObject } from 'lib/util'; const { serverRuntimeConfig, publicRuntimeConfig } = getConfig(); diff --git a/src/pages/_document.js b/src/pages/_document.js index 9ea368ac..93c8aa6e 100644 --- a/src/pages/_document.js +++ b/src/pages/_document.js @@ -50,7 +50,6 @@ class MyDocument extends Document { return ( -