-
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
6cfbd0c
commit 6bed0bd
Showing
7 changed files
with
36 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -66,7 +66,6 @@ | |
] | ||
}, | ||
"dependencies": { | ||
"dotenv": "^16.0.1", | ||
"express": "^4.18.1", | ||
"morgan": "^1.10.0" | ||
}, | ||
|
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,11 @@ | ||
const argv = require('../utils/argv'); | ||
|
||
const DEFAULT_PORT = 8000; | ||
|
||
const portFromArguments = argv('port'); | ||
|
||
if (portFromArguments) { | ||
process.env.PORT = portFromArguments; | ||
} else { | ||
process.env.PORT = DEFAULT_PORT; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const process = require('process'); | ||
|
||
const argv = (key) => { | ||
// Return true if the key exists and a value is defined | ||
if (process.argv.includes(`--${key}`)) return true; | ||
|
||
const value = process.argv.find((element) => element.startsWith(`--${key}=`)); | ||
|
||
// Return null if the key does not exist and a value is not defined | ||
if (!value) return null; | ||
|
||
return value.replace(`--${key}=`, ''); | ||
}; | ||
|
||
module.exports = argv; |
File renamed without changes.