Skip to content

Commit 6c0ded1

Browse files
committed
Fix region env interpolation
1 parent 923c585 commit 6c0ded1

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

docusaurus.config.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,24 @@ const config = {
167167
},
168168
}),
169169

170-
plugins: ["docusaurus-plugin-sass"],
170+
plugins: [
171+
"docusaurus-plugin-sass",
172+
function envDefinePlugin() {
173+
return {
174+
name: "env-define-plugin",
175+
configureWebpack() {
176+
const webpack = require("webpack");
177+
return {
178+
plugins: [
179+
new webpack.DefinePlugin({
180+
"process.env.REGION": JSON.stringify(process.env.REGION || "cn"),
181+
}),
182+
],
183+
};
184+
},
185+
};
186+
},
187+
],
171188
};
172189

173190
module.exports = config;

src/constants/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const BRAND: string = "leancloud";
2-
export const REGION: string = "cn";
2+
export const REGION: string = process.env.REGION || "cn";
33

44
// Cloud Engine
55
export const CLI_BINARY: string = BRAND === "tds" ? "tds" : "lean";

0 commit comments

Comments
 (0)