From 840a3ddb80dd79e6a524dfc11eae716629d88608 Mon Sep 17 00:00:00 2001 From: Kirill Kurko Date: Sun, 17 Mar 2024 18:58:37 +0300 Subject: [PATCH 1/2] Detect env based on VERCEL_ENV variable --- .gitignore | 2 +- src/lib/database/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 52af028d..d1cc8128 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,4 @@ yarn-error.log* .vercel # contentlayer -.contentlayer \ No newline at end of file +.contentlayer diff --git a/src/lib/database/utils.ts b/src/lib/database/utils.ts index 3685866c..1019e94d 100644 --- a/src/lib/database/utils.ts +++ b/src/lib/database/utils.ts @@ -13,7 +13,7 @@ export function getEmojiKey(emojiName: EmojiName) { } function getEnvStorageKey(key: string) { - const env = process.env.NODE_ENV; + const env = process.env.VERCEL_ENV; const envPrefix = env === 'production' ? 'production' : 'staging'; return `${envPrefix}:${key}`; From 7e3161c138c7048d9d63f7252a0d2968ed33ca31 Mon Sep 17 00:00:00 2001 From: Kirill Kurko Date: Sun, 17 Mar 2024 18:59:30 +0300 Subject: [PATCH 2/2] Update .env.example --- .env.example | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 66f1fd02..78a7179b 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,4 @@ -# For emoji board -DATABASE_URL='mysql://...' +# For emoji board and blog post views +REDIS_REST_API_TOKEN="...=" +REDIS_REST_API_URL="..." +VERCEL_ENV="development"