ActivityPods Solid-OIDC auth flow in AuthGate with pod provider picker and /login callback
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Runtime configuration — values the server injects via `/festipod-config.json`.
|
||||
*
|
||||
* The browser bundle cannot read `process.env`, and `build.ts` only bakes in the
|
||||
* shared-wallet material. Everything else the frontend needs at runtime lives
|
||||
* here: backend URL, Solid-OIDC client id, and default Pod provider URL.
|
||||
*
|
||||
* `frontend.tsx` fetches the config endpoint and calls `setRuntimeConfig` before
|
||||
* the app tree evaluates, so any module that imports this file reads the current
|
||||
* values. Keeping the shape flat and env-driven lets dev/staging/prod differ
|
||||
* without rebuilding.
|
||||
*/
|
||||
|
||||
export interface RuntimeConfig {
|
||||
/** URL of the Festipod backend as seen by the browser. */
|
||||
backendUrl?: string;
|
||||
/** Solid-OIDC `client_id`; when empty, derived as `${backendUrl}/app`. */
|
||||
backendClientId?: string;
|
||||
/** Default Pod provider URL; when empty, the picker asks the user. */
|
||||
podProviderUrl?: string;
|
||||
}
|
||||
|
||||
let runtimeConfig: RuntimeConfig = {};
|
||||
|
||||
/** Replace the runtime config. Called once by `frontend.tsx` before `App` loads. */
|
||||
export function setRuntimeConfig(cfg: RuntimeConfig): void {
|
||||
runtimeConfig = cfg;
|
||||
}
|
||||
|
||||
/** The current runtime config. */
|
||||
export function getRuntimeConfig(): RuntimeConfig {
|
||||
return runtimeConfig;
|
||||
}
|
||||
|
||||
/** URL of the Festipod backend, when configured. */
|
||||
export function getBackendUrl(): string | undefined {
|
||||
return runtimeConfig.backendUrl?.trim() || undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user