-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4278b55
commit 5c1ce16
Showing
4 changed files
with
31 additions
and
16 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,13 +1,28 @@ | ||
import dotenv from "dotenv"; | ||
|
||
dotenv.config({ path: "./env.prod" }); | ||
|
||
export const PORT: number = parseInt(process.env.PORT || "8080", 10); | ||
export const MONGODB_URI: string = | ||
process.env.MONGODB_URI || "mongodb://localhost:27017/suriya"; | ||
export const API_VERSION: string = process.env.API_VERSION || "1.5.5"; | ||
export const PASSPORT_SECRET: string = "nodeauthsecret"; | ||
export const config = { | ||
dotenv.config({}); | ||
|
||
const baseConfig = { | ||
PORT: parseInt(process.env.PORT || "8080", 10), | ||
API_VERSION: process.env.API_VERSION || "1.5.5", | ||
PASSPORT_SECRET: "nodeauthsecret", | ||
jwtSecret: "JWT Secret", | ||
jwtSession: { session: false }, | ||
}; | ||
let envConfig; | ||
switch (process.env.PROD_ENV) { | ||
case "prod": | ||
envConfig = { | ||
MONGODB_URI: process.env.MONGODB_URI_PROD, | ||
}; | ||
break; | ||
default: | ||
envConfig = { | ||
MONGODB_URI: | ||
process.env.MONGODB_URI || "mongodb://localhost:27017/suriya", | ||
}; | ||
} | ||
|
||
const config = { ...baseConfig, ...envConfig }; | ||
|
||
export default config; |
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
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
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