From 6c0ded1026310246db879eb130cd04962391f885 Mon Sep 17 00:00:00 2001 From: Wu Yun Date: Fri, 12 Dec 2025 17:07:49 +0800 Subject: [PATCH 1/2] Fix region env interpolation --- docusaurus.config.js | 19 ++++++++++++++++++- src/constants/env.ts | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 85d95cf..530813c 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -167,7 +167,24 @@ const config = { }, }), - plugins: ["docusaurus-plugin-sass"], + plugins: [ + "docusaurus-plugin-sass", + function envDefinePlugin() { + return { + name: "env-define-plugin", + configureWebpack() { + const webpack = require("webpack"); + return { + plugins: [ + new webpack.DefinePlugin({ + "process.env.REGION": JSON.stringify(process.env.REGION || "cn"), + }), + ], + }; + }, + }; + }, + ], }; module.exports = config; diff --git a/src/constants/env.ts b/src/constants/env.ts index ef24d4d..65ebd3e 100644 --- a/src/constants/env.ts +++ b/src/constants/env.ts @@ -1,5 +1,5 @@ export const BRAND: string = "leancloud"; -export const REGION: string = "cn"; +export const REGION: string = process.env.REGION || "cn"; // Cloud Engine export const CLI_BINARY: string = BRAND === "tds" ? "tds" : "lean"; From 61291c87683ca57b715b44afcdb1c908eec0fda9 Mon Sep 17 00:00:00 2001 From: Wu Yun Date: Fri, 12 Dec 2025 17:18:05 +0800 Subject: [PATCH 2/2] Chore: region env comment --- docusaurus.config.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 530813c..fc70a5a 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,6 +1,7 @@ // @ts-check -const PREVIEW = process.env.PREVIEW ?? "false"; +// REGION can be either "cn" or "global" +const REGION = process.env.REGION || "cn"; /** @type {import('@docusaurus/types').Config} */ const config = { @@ -177,7 +178,7 @@ const config = { return { plugins: [ new webpack.DefinePlugin({ - "process.env.REGION": JSON.stringify(process.env.REGION || "cn"), + "process.env.REGION": JSON.stringify(REGION), }), ], };