Skip to content

Commit 1fb66a5

Browse files
committed
Clean up and temp fix for escaping issue
1 parent 6b0c6b1 commit 1fb66a5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/util/postinstall.mjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,21 @@ async function getWebConfig() {
77
// $FIREBASE_WEBAPP_CONFIG can be either a JSON representation of FirebaseOptions or the path
88
// to a filename
99
if (process.env.FIREBASE_WEBAPP_CONFIG) {
10-
if (process.env.FIREBASE_WEBAPP_CONFIG.startsWith("{")) {
10+
if (process.env.FIREBASE_WEBAPP_CONFIG.startsWith("{\"")) {
1111
try {
1212
configFromEnvironment = JSON.parse(process.env.FIREBASE_WEBAPP_CONFIG);
1313
} catch(e) {
1414
console.error("FIREBASE_WEBAPP_CONFIG could not be parsed.", e);
1515
}
16+
} if (process.env.FIREBASE_WEBAPP_CONFIG.startsWith("{")) {
17+
// TODO temporary
18+
configFromEnvironment = Object.fromEntries(
19+
process.env.FIREBASE_WEBAPP_CONFIG
20+
.match(/^{(.+)}$/)[1]
21+
.split(',')
22+
.map(it => it.match("([^\:]+)\:(.+)")?.slice(1))
23+
.filter(it => it)
24+
);
1625
} else {
1726
const fileName = process.env.FIREBASE_WEBAPP_CONFIG;
1827
const fileURL = pathToFileURL(isAbsolute(fileName) ? fileName : join(process.cwd(), fileName));

0 commit comments

Comments
 (0)