mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 05:33:31 +00:00
server, middleware, load label policy 🏷️
This commit is contained in:
3
packages/zitadel-server/src/internal.ts
Normal file
3
packages/zitadel-server/src/internal.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { ZitadelServer } from "./server";
|
||||
|
||||
export const _servers = new Map<string, ZitadelServer>();
|
||||
@@ -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();
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -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[] {
|
||||
|
||||
Reference in New Issue
Block a user