feat: add JD01 YAML-first deployment support
This commit is contained in:
@@ -307,8 +307,12 @@ export interface HwlabRuntimePublicExposureSpec {
|
||||
export interface HwlabRuntimeBootstrapAdminSpec {
|
||||
readonly username: string;
|
||||
readonly displayName: string;
|
||||
readonly usernameSourceRef?: string;
|
||||
readonly usernameSourceKey?: string;
|
||||
readonly usernameSourceLine?: number;
|
||||
readonly passwordSourceRef: string;
|
||||
readonly passwordSourceKey: string;
|
||||
readonly passwordSourceLine?: number;
|
||||
readonly passwordHashTransform: "hwlab-sha256";
|
||||
readonly secretName: string;
|
||||
readonly secretKey: string;
|
||||
@@ -756,11 +760,19 @@ function bootstrapAdminConfig(value: unknown, path: string): HwlabRuntimeBootstr
|
||||
const transform = stringField(raw, "passwordHashTransform", path);
|
||||
if (transform !== "hwlab-sha256") throw new Error(`${path}.passwordHashTransform must be hwlab-sha256`);
|
||||
const rollout = asRecord(raw.rollout, `${path}.rollout`);
|
||||
const usernameSourceRef = raw.usernameSourceRef === undefined ? undefined : sourceRefField(raw, "usernameSourceRef", path);
|
||||
const usernameSourceKey = raw.usernameSourceKey === undefined ? undefined : secretKeyField(raw, "usernameSourceKey", path);
|
||||
const usernameSourceLine = raw.usernameSourceLine === undefined ? undefined : numberField(raw, "usernameSourceLine", path);
|
||||
const passwordSourceLine = raw.passwordSourceLine === undefined ? undefined : numberField(raw, "passwordSourceLine", path);
|
||||
return {
|
||||
username: stringField(raw, "username", path),
|
||||
displayName: stringField(raw, "displayName", path),
|
||||
...(usernameSourceRef === undefined ? {} : { usernameSourceRef }),
|
||||
...(usernameSourceKey === undefined ? {} : { usernameSourceKey }),
|
||||
...(usernameSourceLine === undefined ? {} : { usernameSourceLine }),
|
||||
passwordSourceRef: sourceRefField(raw, "passwordSourceRef", path),
|
||||
passwordSourceKey: secretKeyField(raw, "passwordSourceKey", path),
|
||||
...(passwordSourceLine === undefined ? {} : { passwordSourceLine }),
|
||||
passwordHashTransform: transform,
|
||||
secretName: stringField(raw, "secretName", path),
|
||||
secretKey: secretKeyField(raw, "secretKey", path),
|
||||
@@ -1044,7 +1056,7 @@ function validateConfigRef(ref: string, path: string): void {
|
||||
if (file.startsWith("/") || file.includes("\0") || file.includes("..") || !file.startsWith("config/") || !file.endsWith(".yaml")) {
|
||||
throw new Error(`${path} must reference a repo-relative config/*.yaml file without ..`);
|
||||
}
|
||||
if (!/^[A-Za-z0-9_.\-[\]]+$/u.test(fragment)) {
|
||||
if (!/^[A-Za-z0-9_.\-[\]${}]+$/u.test(fragment)) {
|
||||
throw new Error(`${path} has an unsupported YAML path fragment`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user