接入多发货平台与电子凭证
This commit is contained in:
@@ -3,6 +3,7 @@ import process from "node:process";
|
||||
|
||||
import type {
|
||||
AdminDefaultUser,
|
||||
KuaishouFeifeiProductRule,
|
||||
RuntimeConfig,
|
||||
} from "../types/runtime-config.js";
|
||||
import {
|
||||
@@ -18,6 +19,7 @@ type RuntimeConfigValue =
|
||||
| number
|
||||
| boolean
|
||||
| AdminDefaultUser[]
|
||||
| KuaishouFeifeiProductRule[]
|
||||
| string[];
|
||||
type RuntimeEnv = Record<string, string | undefined>;
|
||||
|
||||
@@ -274,6 +276,36 @@ export const ENV_OVERRIDES: readonly EnvOverride[] = [
|
||||
"kuaishouIndustry",
|
||||
"version",
|
||||
]),
|
||||
stringEnv("KUAISHOU_FEIFEI_BASE_URL", [
|
||||
"platforms",
|
||||
"kuaishouFeifei",
|
||||
"baseUrl",
|
||||
]),
|
||||
stringEnv("KUAISHOU_FEIFEI_APP_KEY", [
|
||||
"platforms",
|
||||
"kuaishouFeifei",
|
||||
"appKey",
|
||||
]),
|
||||
stringEnv("KUAISHOU_FEIFEI_APP_SECRET", [
|
||||
"platforms",
|
||||
"kuaishouFeifei",
|
||||
"appSecret",
|
||||
]),
|
||||
integerEnv("KUAISHOU_FEIFEI_TIMEOUT_MS", [
|
||||
"platforms",
|
||||
"kuaishouFeifei",
|
||||
"timeoutMs",
|
||||
]),
|
||||
stringEnv("KUAISHOU_FEIFEI_NOTIFY_URL", [
|
||||
"platforms",
|
||||
"kuaishouFeifei",
|
||||
"notifyUrl",
|
||||
]),
|
||||
kuaishouFeifeiProductRulesEnv("KUAISHOU_FEIFEI_PRODUCT_RULES_JSON", [
|
||||
"platforms",
|
||||
"kuaishouFeifei",
|
||||
"productRules",
|
||||
]),
|
||||
corsOriginsEnv("CORS_ALLOWED_ORIGINS", ["cors", "allowedOrigins"]),
|
||||
];
|
||||
|
||||
@@ -355,6 +387,20 @@ function adminUsersJsonEnv(
|
||||
};
|
||||
}
|
||||
|
||||
function kuaishouFeifeiProductRulesEnv(
|
||||
env: string,
|
||||
configPath: RuntimeConfigPath
|
||||
): EnvOverride {
|
||||
return {
|
||||
env,
|
||||
path: configPath,
|
||||
read(rawValue) {
|
||||
const parsed = parseJsonArray<KuaishouFeifeiProductRule>(rawValue);
|
||||
return parsed === null ? null : parsed;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function corsOriginsEnv(
|
||||
env: string,
|
||||
configPath: RuntimeConfigPath
|
||||
|
||||
Reference in New Issue
Block a user