Skip to content

Commit 84c32a9

Browse files
Gene Connollygconnolly
authored andcommitted
render env object on window
1 parent 17fd20b commit 84c32a9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

public/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@
2020
Learn how to configure a non-root public URL by running `npm run build`.
2121
-->
2222
<title>React App</title>
23+
<script>
24+
env = <%= JSON.stringify(
25+
Object.keys(process.env)
26+
.filter(key => key.startsWith('REACT_APP') || key == 'PUBLIC_URL')
27+
.reduce((env, key) => {
28+
env[key] = process.env[key]
29+
return env
30+
}, {})
31+
)%>;
32+
</script>
2333
</head>
2434
<body>
2535
<noscript>

0 commit comments

Comments
 (0)