Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

feat: ui env variables remove react_app prefix

shuai5a1a9f0b4b94
diff --git a/ui/.env.production b/ui/.env.production
index 3d8f6a77..c371a163 100644
--- a/ui/.env.production
+++ b/ui/.env.production
@@ -2,4 +2,4 @@ TSC_COMPILE_ON_ERROR=true
ESLINT_NO_DEV_ERRORS=true
PUBLIC_URL=/
REACT_APP_API_URL=/
-REACT_APP_BASE_URL=/test
+REACT_APP_BASE_URL=
diff --git a/ui/scripts/env.js b/ui/scripts/env.js
index df97966c..c9838058 100644
--- a/ui/scripts/env.js
+++ b/ui/scripts/env.js
@@ -12,10 +12,8 @@ const config = yaml.load(fs.readFileSync(configFilePath, 'utf8'));
let envContent = 'TSC_COMPILE_ON_ERROR=true\nESLINT_NO_DEV_ERRORS=true\n';
for (const key in config.ui) {
const value = config.ui[key];
- envContent += `${key.toUpperCase()}=${value}\n`;
+ envContent += `${key !== 'public_url' ? 'REACT_APP_' : ''}${key.toUpperCase()}=${value}\n`;
}
// Write .env file
fs.writeFileSync(envFilePath, envContent);
-
-console.log(`Generated ${envFilePath}`);