fix: wire production Amap adapter
Dada P0-A isolated Windows CI / validate-and-package (push) Failing after 1m47s

This commit is contained in:
suyx
2026-08-04 17:09:04 +08:00
parent a7772a7e92
commit 8c349fb56c
7 changed files with 231 additions and 13 deletions
+11 -4
View File
@@ -1,5 +1,7 @@
import { createConnection } from "node:net";
import { RealAmapAdapter } from "./amap-adapter.js";
const API_CREDENTIALS = ["Dada/P0A/api/resend", "Dada/P0A/api/amap", "Dada/P0A/admin/pepper"] as const;
export async function receiveApiCredentials(input: NodeJS.ReadableStream = process.stdin) {
@@ -26,10 +28,15 @@ export async function receiveApiCredentials(input: NodeJS.ReadableStream = proce
export function initializeApiCredentialClients(credentials: Record<(typeof API_CREDENTIALS)[number], string>) {
const configured = API_CREDENTIALS.every((name) => credentials[name].length > 0);
const adminPepperValue = credentials["Dada/P0A/admin/pepper"];
for (const name of API_CREDENTIALS) credentials[name] = "";
if (!configured) throw new Error("API credential client initialization failed.");
return { adminAllowlistPepper: Buffer.from(adminPepperValue, "utf8") };
try {
if (!configured) throw new Error("API credential client initialization failed.");
return {
adminAllowlistPepper: Buffer.from(credentials["Dada/P0A/admin/pepper"], "utf8"),
amap: new RealAmapAdapter(credentials["Dada/P0A/api/amap"]),
};
} finally {
for (const name of API_CREDENTIALS) credentials[name] = "";
}
}
export function attachApiSupervisorControl(pipeName: string, shutdown: () => Promise<void>) {