All the UI fixes for now
This commit is contained in:
@@ -39,6 +39,28 @@ async function authenticate(): Promise<string> {
|
||||
return token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a KV v2 secret. Path relative to KV mount.
|
||||
* Returns .data.data object or null if 404.
|
||||
*/
|
||||
export async function readSecret(
|
||||
path: string
|
||||
): Promise<Record<string, string> | null> {
|
||||
const token = await authenticate();
|
||||
const res = await fetch(`${OPENBAO_ADDR}/v1/secret/data/${path}`, {
|
||||
headers: { "X-Vault-Token": token },
|
||||
});
|
||||
|
||||
if (res.status === 404) return null;
|
||||
if (!res.ok) {
|
||||
const body = await res.text();
|
||||
throw new Error(`OpenBao read failed: ${res.status} ${body}`);
|
||||
}
|
||||
|
||||
const json = await res.json();
|
||||
return json.data?.data ?? null;
|
||||
}
|
||||
|
||||
export async function writePackageSecrets(
|
||||
tenantId: string,
|
||||
packageId: string,
|
||||
|
||||
Reference in New Issue
Block a user