Add basic dotenv-powered config
This commit is contained in:
parent
c65b054b99
commit
5a45ce9a64
4 changed files with 14 additions and 2 deletions
1
.sample-env
Normal file
1
.sample-env
Normal file
|
@ -0,0 +1 @@
|
|||
SNIPBOT_PORT=5000
|
9
index.js
9
index.js
|
@ -1,12 +1,17 @@
|
|||
const express = require("express")
|
||||
const bodyParser = require("body-parser")
|
||||
|
||||
// Let's load some configuration!
|
||||
require("dotenv").config()
|
||||
|
||||
const port = process.env.SNIPBOT_PORT || 5000
|
||||
|
||||
const app = express()
|
||||
|
||||
app.use(bodyParser.json())
|
||||
|
||||
app.listen(5000, () => {
|
||||
console.log(`Server is running on port 5000.`)
|
||||
app.listen(port, () => {
|
||||
console.log(`Server is running on port ${port}.`)
|
||||
})
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
"private": true,
|
||||
"dependencies": {
|
||||
"body-parser": "^1.19.0",
|
||||
"dotenv": "^8.2.0",
|
||||
"express": "^4.17.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,6 +75,11 @@ destroy@~1.0.4:
|
|||
resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80"
|
||||
integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=
|
||||
|
||||
dotenv@^8.2.0:
|
||||
version "8.2.0"
|
||||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
|
||||
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==
|
||||
|
||||
ee-first@1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
|
||||
|
|
Loading…
Reference in a new issue