diff --git a/web/rollup.config.js b/web/rollup.config.js index 7a15f007e..15cf9f03b 100644 --- a/web/rollup.config.js +++ b/web/rollup.config.js @@ -44,6 +44,7 @@ const resources = [ // eslint-disable-next-line no-undef const isProdBuild = process.env.NODE_ENV === "production"; +const apiBasePath = process.env.AK_API_BASE_PATH || ""; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types function manualChunks(id) { if (id.includes("@goauthentik/api")) { @@ -111,6 +112,7 @@ export default [ }), replace({ "process.env.NODE_ENV": JSON.stringify(isProdBuild ? "production" : "development"), + "process.env.AK_API_BASE_PATH": JSON.stringify(apiBasePath), "preventAssignment": true, }), sourcemaps(), @@ -144,6 +146,7 @@ export default [ }), replace({ "process.env.NODE_ENV": JSON.stringify(isProdBuild ? "production" : "development"), + "process.env.AK_API_BASE_PATH": JSON.stringify(apiBasePath), "preventAssignment": true, }), sourcemaps(), @@ -177,6 +180,7 @@ export default [ }), replace({ "process.env.NODE_ENV": JSON.stringify(isProdBuild ? "production" : "development"), + "process.env.AK_API_BASE_PATH": JSON.stringify(apiBasePath), "preventAssignment": true, }), sourcemaps(), diff --git a/web/src/api/Config.ts b/web/src/api/Config.ts index a22432582..d1270964b 100644 --- a/web/src/api/Config.ts +++ b/web/src/api/Config.ts @@ -50,7 +50,7 @@ export function tenant(): Promise { } export const DEFAULT_CONFIG = new Configuration({ - basePath: "/api/v3", + basePath: process.env.AK_API_BASE_PATH + "/api/v3", headers: { "X-CSRFToken": getCookie("authentik_csrf"), }, @@ -61,4 +61,4 @@ export const DEFAULT_CONFIG = new Configuration({ ], }); -console.debug(`authentik(early): version ${VERSION}`); +console.debug(`authentik(early): version ${VERSION}, apiBase ${DEFAULT_CONFIG.basePath}`);