Skip to content

Commit dec2db2

Browse files
committed
configurable port for app and development
application port: PORT port for development: PORT_DEV PORT_DEV will take effect when run gulp browser-sync. Meaning that PORT_DEV will take effect when run `npm run dev` too.
1 parent eaeedbd commit dec2db2

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

.env.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"SESSION_SECRET": "DEFAULT",
33
"LOGGER_SILENT": "false",
44
"LOGGER_LEVEL": "info",
5+
"PORT": 5000,
6+
"PORT_DEV": 3000,
57

68
"KANCOLLE_SERVER_MASTER": "http://203.104.209.7",
79
"KANCOLLE_SERVER_1" : "http://203.104.209.71",

gulpfile.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
'use strict'
22

3+
const appPort = process.env.PORT
4+
const devPort = process.env.PORT_DEV
5+
const css = 'src/views/*.css'
6+
const htmlTemplate = 'src/views/**/*.hbs'
7+
38
const gulp = require('gulp')
49
const postcss = require('gulp-postcss')
510
const autoprefixer = require('autoprefixer')
@@ -8,10 +13,6 @@ const rename = require('gulp-rename')
813
const bs = require('browser-sync').create()
914
const nodemon = require('gulp-nodemon')
1015

11-
const devPort = 8080
12-
const css = 'src/views/*.css'
13-
const htmlTemplate = 'src/views/**/*.hbs'
14-
1516
gulp.task('build', ['build:css'])
1617

1718
gulp.task('build:css', () => {
@@ -28,7 +29,7 @@ gulp.task('nodemon', done => {
2829
return nodemon({
2930
script: 'bin/www',
3031
ignore: ['gulpfile.js', 'node_modules/', 'src/views/'],
31-
env: {PORT: devPort}
32+
env: {PORT: appPort}
3233
})
3334
.on('start', () => {
3435
if(!start) {
@@ -40,7 +41,8 @@ gulp.task('nodemon', done => {
4041

4142
gulp.task('browser-sync', ['nodemon'], () => {
4243
bs.init({
43-
proxy: `localhost:${devPort}`,
44+
proxy: `localhost:${appPort}`,
45+
port: devPort,
4446
open: false
4547
})
4648

0 commit comments

Comments
 (0)