fix: use owner-level unidesk state
This commit is contained in:
@@ -2666,7 +2666,7 @@ function readSentinelSecretSourceValue(source: Record<string, unknown>): Record<
|
||||
const sourceKey = stringAt(source, "sourceKey");
|
||||
const sourceLine = numberAtNullable(source, "sourceLine");
|
||||
const paths = secretSourcePaths(sourceRef);
|
||||
const sourcePath = paths.find((item) => existsSync(item)) ?? paths[0] ?? join(repoRoot, ".state", "secrets", sourceRef);
|
||||
const sourcePath = paths.find((item) => existsSync(item)) ?? paths[0] ?? rootPath(".state", "secrets", sourceRef);
|
||||
if (!existsSync(sourcePath)) return { ok: false, error: "secret-source-missing", sourceRef, sourceKey, sourcePath: displayPath(sourcePath), valuesRedacted: true };
|
||||
const textValue = readFileSync(sourcePath, "utf8");
|
||||
const value = sourceLine === null ? parseEnvFile(textValue)[sourceKey] : textValue.split(/\r?\n/u)[sourceLine - 1]?.replace(/\r$/u, "");
|
||||
@@ -2688,7 +2688,7 @@ function readSentinelWebAccountUsername(source: Record<string, unknown>): { ok:
|
||||
const sourceLine = numberAtNullable(source, "usernameSourceLine");
|
||||
if (sourceRef === null || sourceLine === null) return { ok: false, error: "web-account-json-username-missing" };
|
||||
const paths = secretSourcePaths(sourceRef);
|
||||
const sourcePath = paths.find((item) => existsSync(item)) ?? paths[0] ?? join(repoRoot, ".state", "secrets", sourceRef);
|
||||
const sourcePath = paths.find((item) => existsSync(item)) ?? paths[0] ?? rootPath(".state", "secrets", sourceRef);
|
||||
if (!existsSync(sourcePath)) return { ok: false, error: "web-account-json-username-source-missing" };
|
||||
const value = readFileSync(sourcePath, "utf8").split(/\r?\n/u)[sourceLine - 1]?.replace(/\r$/u, "") ?? "";
|
||||
return value.length === 0 ? { ok: false, error: "web-account-json-username-line-missing" } : { ok: true, value };
|
||||
@@ -2720,7 +2720,7 @@ function readSentinelFrpcMaterial(state: SentinelCicdState): Record<string, unkn
|
||||
const sourceRef = stringAt(state.publicExposure, "frpc.tokenSourceRef");
|
||||
const sourceKey = stringAt(state.publicExposure, "frpc.tokenSourceKey");
|
||||
const paths = secretSourcePaths(sourceRef);
|
||||
const sourcePath = paths.find((item) => existsSync(item)) ?? paths[0] ?? join(repoRoot, ".state", "secrets", sourceRef);
|
||||
const sourcePath = paths.find((item) => existsSync(item)) ?? paths[0] ?? rootPath(".state", "secrets", sourceRef);
|
||||
if (!existsSync(sourcePath)) return { ok: false, error: "frp-token-source-missing", sourceRef, sourceKey, sourcePath: displayPath(sourcePath), valuesRedacted: true };
|
||||
const values = parseEnvFile(readFileSync(sourcePath, "utf8"));
|
||||
const token = values[sourceKey];
|
||||
|
||||
Reference in New Issue
Block a user