management labelpolicy

This commit is contained in:
Max Peintner
2023-04-21 13:49:15 +02:00
parent 238a73d923
commit 12eb60c084
5 changed files with 56 additions and 11 deletions

View File

@@ -1,5 +1,6 @@
export * from "./server";
export * from "./middleware";
export * from "./management";
// export * as auth from "./auth";
// export * as management from "./management";

View File

@@ -1 +1,3 @@
export * from "./management";
export * as management from "../proto/server/zitadel/management";
export * from "../proto/server/zitadel/policy";

View File

@@ -26,10 +26,19 @@ export function getServers(): ZitadelServer[] {
return apps;
}
export function getServer(name?: string): ZitadelServer | undefined {
return name
? apps.find((a) => a.name === name)
: apps.length === 1
? apps[0]
: undefined;
export function getServer(name?: string): ZitadelServer {
if (name) {
const found = apps.find((a) => a.name === name);
if (found) {
return found;
} else {
throw new Error("No server found");
}
} else {
if (apps.length) {
return apps[0];
} else {
throw new Error("No server found");
}
}
}