From 09873c78d337909f74292ac2fad5cea9a30fe674 Mon Sep 17 00:00:00 2001 From: Fredrik Monsen Date: Fri, 13 Sep 2024 12:39:14 +0200 Subject: [PATCH] update readme, cleanup --- .env.example | 1 + README.md | 17 +++++++++-------- next.config.mjs | 1 - src/app/api/auth/refresh/route.ts | 2 +- src/app/api/auth/signin/route.ts | 2 +- src/app/api/auth/signout/route.ts | 2 +- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.env.example b/.env.example index 331c5a7..352d8c1 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,4 @@ NEXT_PUBLIC_BASE_PATH=/hugin CATALOGUE_API_PATH=http://localhost:8087/bikube DATABASE_URL='' +AUTH_API=http://localhost:8088/auth diff --git a/README.md b/README.md index 25411a0..f7589a4 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,15 @@ For å kjøre lokalt må du sette de nødvendige miljøvariablene: cp .env.example .env.local ``` -| Variabelnavn | Standardverdi | Beskrivelse | -|------------------------------|------------------------------|-----------------------------------------------------------------------------------------------------------------------------| -| NEXT_PUBLIC_BASE_PATH | /hugin | Base path for applikasjonen | -| CATALOGUE_API_PATH | http://localhost:8087/bikube | Sti til [katalog APIet ](https://github.com/NationalLibraryOfNorway/bikube)
Må starte med `http://` eller `https://` | -| DATABASE_URL | | URL til databasen (se mer info i eget avsnitt under) | -| KEYCLOAK_TEKST_URL | | Url til keycloak-tekst (inkl. realm om open-idconnect, eks. https://mysite.com/authn/realms/myRealm/protocol/openid-connect | -| KEYCLOAK_TEKST_CLIENT_ID | | Client ID i keycloak-tekst | -| KEYCLOAK_TEKST_CLIENT_SECRET | | Client secret i keycloak-tekst | +| Variabelnavn | Standardverdi | Beskrivelse | +|------------------------------|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------| +| NEXT_PUBLIC_BASE_PATH | /hugin | Base path for applikasjonen | +| CATALOGUE_API_PATH | http://localhost:8087/bikube | Sti til [katalog APIet ](https://github.com/NationalLibraryOfNorway/bikube)
Må starte med `http://` eller `https://` | +| AUTH_API_PATH | http://localhost:8080/tekst-auth | Sti til [autentiserings APIet](https://github.com/NationalLibraryOfNorway/tekst-auth)
Må starte med `http://` eller `https://` | +| DATABASE_URL | | URL til databasen (se mer info i eget avsnitt under) | +| KEYCLOAK_TEKST_URL | | Url til keycloak-tekst (inkl. realm om open-idconnect, eks. https://mysite.com/authn/realms/myRealm/protocol/openid-connect | +| KEYCLOAK_TEKST_CLIENT_ID | | Client ID i keycloak-tekst | +| KEYCLOAK_TEKST_CLIENT_SECRET | | Client secret i keycloak-tekst | Deretter må du kjøre følgende kommandoer: ```bash diff --git a/next.config.mjs b/next.config.mjs index 52fdd83..195286c 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,7 +1,6 @@ import {withSentryConfig} from "@sentry/nextjs"; /** @type {import('next').NextConfig} */ const nextConfig = { - reactStrictMode: false, output: "standalone", basePath: process.env.NEXT_PUBLIC_BASE_PATH, async rewrites() { diff --git a/src/app/api/auth/refresh/route.ts b/src/app/api/auth/refresh/route.ts index 000b45c..ee5f9ba 100644 --- a/src/app/api/auth/refresh/route.ts +++ b/src/app/api/auth/refresh/route.ts @@ -8,7 +8,7 @@ export async function POST(req: NextRequest) { return NextResponse.json({error: 'No user token found'}, {status: 401}); } - const data = await fetch(`${process.env.AUTH_API}/refresh`, { + const data = await fetch(`${process.env.AUTH_API_PATH}/refresh`, { method: 'POST', headers: { 'Content-Type': 'application/json' diff --git a/src/app/api/auth/signin/route.ts b/src/app/api/auth/signin/route.ts index 6202d7f..4bdb471 100644 --- a/src/app/api/auth/signin/route.ts +++ b/src/app/api/auth/signin/route.ts @@ -10,7 +10,7 @@ interface LoginRequest { export async function POST(req: NextRequest) { const {code, redirectUrl} = await req.json() as LoginRequest; - const data = await fetch(`${process.env.AUTH_API}/login?${redirectUrl}`, { + const data = await fetch(`${process.env.AUTH_API_PATH}/login?${redirectUrl}`, { method: 'POST', headers: { 'Content-Type': 'application/json' diff --git a/src/app/api/auth/signout/route.ts b/src/app/api/auth/signout/route.ts index 45398e9..a18104c 100644 --- a/src/app/api/auth/signout/route.ts +++ b/src/app/api/auth/signout/route.ts @@ -7,7 +7,7 @@ export async function POST(req: NextRequest) { return NextResponse.json({error: 'No user token found'}, {status: 401}); } - return await fetch(`${process.env.AUTH_API}/logout`, { + return await fetch(`${process.env.AUTH_API_PATH}/logout`, { method: 'POST', headers: { 'Content-Type': 'application/json'