-
Notifications
You must be signed in to change notification settings - Fork 0
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
0d6a08b
commit eeb0664
Showing
4 changed files
with
43 additions
and
1 deletion.
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,7 @@ | ||
import App from './src/app'; | ||
import config from "./src/config/config"; | ||
|
||
const PORT = 3000; | ||
const PORT = config.port; | ||
const app = new App(PORT); | ||
|
||
app.startServer(); |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
import developmentConfig from "./development"; | ||
import productionConfig from "./production" | ||
|
||
export enum EnvironmentStr { | ||
DEVELOPMENT = "development", | ||
TESTING = "testing", | ||
STAGE = "staging", | ||
PRODUCTION = "production", | ||
} | ||
|
||
const {ENVIRONMENT} = process.env; | ||
export const production = ENVIRONMENT === EnvironmentStr.PRODUCTION; | ||
export const development = ENVIRONMENT === EnvironmentStr.DEVELOPMENT; | ||
|
||
const config = () =>{ | ||
if(production){ | ||
return productionConfig; | ||
} else { | ||
return developmentConfig; | ||
} | ||
} | ||
|
||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
import merge from "deepmerge"; | ||
import production from './production'; | ||
|
||
const config = { | ||
port : 3000, | ||
debug: true, | ||
} satisfies Record<string,number|boolean> | ||
|
||
export default merge(production,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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const config = { | ||
port : 3000, | ||
debug: true, | ||
} satisfies Record<string,number|boolean> | ||
|
||
export default config; |