⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
fix: strip quoted runtime placeholders
Tinf983f34e3ccb
diff --git a/apps/web/env.sh b/apps/web/env.shindex b9ced400c..617f2994e 100644--- a/apps/web/env.sh+++ b/apps/web/env.sh@@ -55,14 +55,14 @@ for key in $(env | grep '^KANEO_' | grep -v 'KANEO_API_URL\|KANEO_CLIENT_URL' |fidone-# Empty any remaining `"KANEO_*"` placeholder whose env var was left unset.+# Empty any remaining quoted `KANEO_*` placeholder whose env var was left unset.# Without this, the literal placeholder stays in the bundle and is read by# the frontend as a truthy string — which broke self-hosted signup when# KANEO_TURNSTILE_SITE_KEY was left unset (issue #1304). Apply to any future# runtime-substituted flag so the same trap doesn't recur.echo "Stripping unset KANEO_* placeholders..."find /usr/share/nginx/html -type f \( -name "*.js" -o -name "*.css" \) \- -exec grep -lE '"KANEO_[A-Z_]+"' {} \; \- | xargs -r sed -i -E 's#"KANEO_[A-Z_]+"#""#g'+ -exec grep -lE '[`"'"'"']KANEO_[A-Z_]+[`"'"'"']' {} \; \+ | xargs -r sed -i -E 's#[`"'"'"']KANEO_[A-Z_]+[`"'"'"']#""#g'echo "✅ Environment variable replacement complete"diff --git a/apps/web/src/env.test.ts b/apps/web/src/env.test.tsnew file mode 100644index 000000000..79a2e6fd2--- /dev/null+++ b/apps/web/src/env.test.ts@@ -0,0 +1,39 @@+import { execFileSync } from "node:child_process";+import { readFileSync } from "node:fs";+import path from "node:path";+import { describe, expect, it } from "vitest";++const placeholderPattern = "[`\\\"']KANEO_[A-Z_]+[`\\\"']";++describe("runtime environment replacement", () => {+ it("strips unset placeholders regardless of the quote emitted by the bundler", () => {+ const bundle = [+ 'const doubleQuoted = "KANEO_DOUBLE_QUOTED";',+ "const singleQuoted = 'KANEO_SINGLE_QUOTED';",+ "const templateLiteral = `KANEO_TEMPLATE_LITERAL`;",+ 'const configured = "https://example.com";',+ ].join("\n");++ const result = execFileSync("sed", ["-E", `s#${placeholderPattern}#""#g`], {+ input: bundle,+ encoding: "utf8",+ });++ expect(result).not.toMatch(/KANEO_[A-Z_]+/);+ expect(result).toContain('const doubleQuoted = "";');+ expect(result).toContain('const singleQuoted = "";');+ expect(result).toContain('const templateLiteral = "";');+ expect(result).toContain('const configured = "https://example.com";');+ });++ it("uses the quote-agnostic pattern in the container entrypoint", () => {+ const entrypoint = readFileSync(+ path.resolve(import.meta.dirname, "../env.sh"),+ "utf8",+ );++ expect(entrypoint).toContain(+ `sed -i -E 's#[\`"'"'"']KANEO_[A-Z_]+[\`"'"'"']#""#g'`,+ );+ });+});