mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-22 08:38:13 +02:00
feat: add authentication for OSS (#167)
* feat: add authentication for OSS Fixes #157 and #156 * fix: fix token generation * fix: limit fastapi workers to 1
This commit is contained in:
parent
0791975864
commit
642cc34e8c
48 changed files with 994 additions and 303 deletions
|
|
@ -2,10 +2,14 @@
|
|||
|
||||
import { createContext, ReactNode, useContext, useEffect, useState } from 'react';
|
||||
|
||||
import { client } from '@/client/client.gen';
|
||||
|
||||
interface AppConfig {
|
||||
uiVersion: string;
|
||||
apiVersion: string;
|
||||
backendApiEndpoint: string | null;
|
||||
deploymentMode: string;
|
||||
authProvider: string;
|
||||
}
|
||||
|
||||
interface AppConfigContextType {
|
||||
|
|
@ -17,6 +21,8 @@ const defaultConfig: AppConfig = {
|
|||
uiVersion: 'dev',
|
||||
apiVersion: 'unknown',
|
||||
backendApiEndpoint: null,
|
||||
deploymentMode: 'oss',
|
||||
authProvider: 'local',
|
||||
};
|
||||
|
||||
const AppConfigContext = createContext<AppConfigContextType>({
|
||||
|
|
@ -32,10 +38,17 @@ export function AppConfigProvider({ children }: { children: ReactNode }) {
|
|||
fetch('/api/config/version')
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
// Use clientApiBaseUrl (filtered for browser-reachable URLs)
|
||||
// to configure the API client; keep backendApiEndpoint for display
|
||||
if (data.clientApiBaseUrl) {
|
||||
client.setConfig({ baseUrl: data.clientApiBaseUrl });
|
||||
}
|
||||
setConfig({
|
||||
uiVersion: data.ui || 'dev',
|
||||
apiVersion: data.api || 'unknown',
|
||||
backendApiEndpoint: data.backendApiEndpoint || null,
|
||||
deploymentMode: data.deploymentMode || 'oss',
|
||||
authProvider: data.authProvider || 'local',
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue