chore: Set client's version in index.html at runtime (#29318)

[Slack thread with a lot more details and
discussion](https://theappsmith.slack.com/archives/C02MUD8DNUR/p1701759438660509).

This will help us move towards having `info.json` as the one source of
truth for Appsmith version.
This commit is contained in:
Shrikant Sharat Kandula 2023-12-06 06:57:22 +05:30 committed by GitHub
parent b41cbe86b8
commit 18eb6790bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View File

@ -304,8 +304,20 @@ export const getAppsmithConfigs = (): AppsmithUIConfigs => {
ENV_CONFIG.logLevel || APPSMITH_FEATURE_CONFIGS?.logLevel || false,
enableTNCPP:
ENV_CONFIG.enableTNCPP || APPSMITH_FEATURE_CONFIGS?.enableTNCPP || false,
appVersion:
ENV_CONFIG.appVersion || APPSMITH_FEATURE_CONFIGS?.appVersion || false,
appVersion: {
id:
APPSMITH_FEATURE_CONFIGS?.appVersion?.id ||
ENV_CONFIG.appVersion?.id ||
"",
releaseDate:
APPSMITH_FEATURE_CONFIGS?.appVersion?.releaseDate ||
ENV_CONFIG.appVersion?.releaseDate ||
"",
edition:
ENV_CONFIG.appVersion?.edition ||
APPSMITH_FEATURE_CONFIGS?.appVersion?.edition ||
"",
},
intercomAppID:
ENV_CONFIG.intercomAppID || APPSMITH_FEATURE_CONFIGS?.intercomAppID || "",
mailEnabled:

View File

@ -14,6 +14,11 @@ apply-env-vars() {
served="$2"
node -e '
const fs = require("fs")
try {
const info = JSON.parse(fs.readFileSync("/opt/appsmith/info.json", "utf8"))
process.env.APPSMITH_VERSION_ID = info.version || ""
process.env.APPSMITH_VERSION_RELEASE_DATE = info.imageBuiltAt || ""
} catch {}
const content = fs.readFileSync("'"$original"'", "utf8").replace(
/\b__(APPSMITH_[A-Z0-9_]+)__\b/g,
(placeholder, name) => (process.env[name] || "")