1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-22 01:03:37 +01:00

production check for env vars

This commit is contained in:
Matthias Kretschmann 2022-12-02 23:44:35 +00:00
parent 52b455b109
commit 21071a1e0f
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -1,7 +1,8 @@
const UMAMI_SCRIPT_URL = process.env.GATSBY_UMAMI_SCRIPT_URL
const UMAMI_WEBSITE_ID = process.env.GATSBY_UMAMI_WEBSITE_ID
const isProduction = process.env.NODE_ENV === 'production'
if (!UMAMI_SCRIPT_URL || !UMAMI_WEBSITE_ID) {
if (isProduction && (!UMAMI_SCRIPT_URL || !UMAMI_WEBSITE_ID)) {
throw new Error('Missing Umami environment variables')
}