Skip to content

Commit

Permalink
feat: add env and dotenv (#519)
Browse files Browse the repository at this point in the history
* Option to specify port

Resolves: #242
  • Loading branch information
Gustavo Pereira committed Feb 15, 2021
1 parent 6d43f5b commit bacd991
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PORT=4000
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ release
.idea

*.sublime-project
*.sublime-workspace
*.sublime-workspace

.env
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
"auto-launch": "^5.0.1",
"cerebro-tools": "0.1.8",
"cerebro-ui": "^0.0.16",
"dotenv": "^8.2.0",
"escape-string-regexp": "1.0.5",
"fix-path": "2.1.0",
"lodash": "^4.17.4",
Expand Down
4 changes: 2 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint no-console: 0 */

require('dotenv').config()
const express = require('express')
const webpack = require('webpack')
const webpackDevMiddleware = require('webpack-dev-middleware')
Expand All @@ -9,7 +9,7 @@ const config = require('./webpack.config.development')

const app = express()
const compiler = webpack(config)
const PORT = 3000
const PORT = process.env.PORT || 3000

const wdm = webpackDevMiddleware(compiler, {
publicPath: config.output.publicPath,
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1899,6 +1899,11 @@ dot-prop@^4.1.0:
dependencies:
is-obj "^1.0.0"

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==

duplexer2@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.0.2.tgz#c614dcf67e2fb14995a91711e5a617e8a60a31db"
Expand Down

0 comments on commit bacd991

Please sign in to comment.