This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Strict check bool envs in config (#1046)
- Loading branch information
1 parent
699abc2
commit fab1669
Showing
2 changed files
with
7 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@staart/api", | ||
"version": "1.3.148", | ||
"version": "1.3.149", | ||
"main": "index.js", | ||
"repository": "[email protected]:staart/api.git", | ||
"author": "Anand Chowdhary <[email protected]>", | ||
|
@@ -91,5 +91,5 @@ | |
"setup" | ||
], | ||
"snyk": true, | ||
"staart-version": "1.3.148" | ||
"staart-version": "1.3.149" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import { config } from "dotenv"; | ||
config(); | ||
|
||
export const bool = (val?: string | boolean) => | ||
String(val).toLowerCase() === "true"; | ||
|
||
// Server | ||
export const PORT = process.env.PORT ? parseInt(process.env.PORT) : 80; | ||
export const BASE_URL = process.env.BASE_URL || ""; | ||
|
@@ -62,7 +65,7 @@ export const CACHE_CHECK_PERIOD = process.env.CACHE_CHECK_PERIOD | |
|
||
export const FRONTEND_URL = process.env.FRONTEND_URL || "https://example.com"; | ||
export const ALLOW_DISPOSABLE_EMAILS = !!process.env.DISPOSABLE_EMAIL; | ||
export const ALLOW_DISPOSABLE_EMAILS = bool(process.env.DISPOSABLE_EMAIL); | ||
export const TEST_EMAIL = process.env.TEST_EMAIL || "[email protected]"; | ||
/// If you want to use AWS SES to send emails: | ||
export const SES_EMAIL = process.env.SES_EMAIL || ""; | ||
|
@@ -92,7 +95,7 @@ export const TOKEN_EXPIRY_REFRESH = process.env.TOKEN_EXPIRY_REFRESH || "30d"; | |
export const TOKEN_EXPIRY_API_KEY_MAX = process.env.TOKEN_EXPIRY_API_KEY_MAX | ||
? parseInt(process.env.TOKEN_EXPIRY_API_KEY_MAX) | ||
: 10413685800000; // 2299-12-31 is the default maximum expiry (also what Microsoft uses) | ||
export const DISALLOW_OPEN_CORS = !!process.env.DISALLOW_OPEN_CORS; | ||
export const DISALLOW_OPEN_CORS = bool(process.env.DISALLOW_OPEN_CORS); | ||
|
||
// OAuth2 credentials | ||
export const GOOGLE_CLIENT_ID = process.env.GOOGLE_CLIENT_ID || ""; | ||
|