server, middleware, load label policy 🏷️

This commit is contained in:
Max Peintner
2023-04-21 15:13:14 +02:00
parent 12eb60c084
commit 12b9042392
9 changed files with 65 additions and 32 deletions

View File

@@ -0,0 +1,3 @@
import { ZitadelServer } from "./server";
export const _servers = new Map<string, ZitadelServer>();

View File

@@ -25,6 +25,7 @@ const createClient = <Client>(
};
export const getManagement = (app?: string | ZitadelServer) => {
console.log("init management");
let config;
if (app && typeof app === "string") {
const apps = getServers();

View File

@@ -12,3 +12,6 @@ export const authMiddleware = (token: string) =>
return yield* call.next(call.request, options);
};
export const orgMetadata = (orgId: string) =>
new Metadata({ "x-zitadel-orgid": orgId });

View File

@@ -9,17 +9,24 @@ export interface ZitadelServerOptions extends ZitadelServerProps {
name?: string;
}
export interface ZitadelServer {
name: string | undefined;
config: ZitadelServerProps;
}
export async function initializeServer(
export function initializeServer(
config: ZitadelServerProps,
name?: string
): Promise<ZitadelServer> {
const app = { config, name };
return app;
): ZitadelServer {
const server = new ZitadelServer(config, name);
return server;
}
export class ZitadelServer {
name: string | undefined;
config: ZitadelServerProps;
constructor(config: ZitadelServerProps, name?: string) {
if (name) {
this.name = name;
}
this.config = config;
}
}
export function getServers(): ZitadelServer[] {