Commit 1fdb419 1 parent 4bd69f3 commit 1fdb419 Copy full SHA for 1fdb419
File tree 2 files changed +17
-3
lines changed
2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 3
3
// Import Packages
4
4
const winston = require ( 'winston' )
5
5
const nconf = require ( 'nconf' )
6
+ const path = require ( 'path' )
6
7
const colors = require ( 'colors/safe' )
7
8
const Koa = require ( 'koa' ) // Koa v2
8
9
// const mail = require('./src/mail')
9
10
11
+ // Read Command
12
+ let configFile
13
+ const paramsArray = process . argv . slice ( 2 )
14
+ if ( paramsArray . length > 1 ) {
15
+ // exist params
16
+ if ( paramsArray [ 0 ] === '--config_file' ) {
17
+ configFile = path . join ( './' , paramsArray [ 1 ] )
18
+ }
19
+ }
20
+
10
21
// PreStart
11
22
const preStart = require ( './src/prestart' )
12
- preStart . load ( )
23
+ preStart . load ( configFile )
13
24
14
25
// Use blubird promise
15
26
global . Promise = require ( 'bluebird' )
Original file line number Diff line number Diff line change @@ -58,9 +58,12 @@ function printCopyright () {
58
58
}
59
59
60
60
module . exports = {
61
- load : ( ) => {
61
+ load : ( config_file ) => {
62
+ if ( ! config_file ) {
63
+ config_file = path . join ( __dirname , '../' , 'config.json' )
64
+ }
62
65
setupWinston ( )
63
- loadConfig ( path . join ( __dirname , '../' , 'config.json' ) )
66
+ loadConfig ( config_file )
64
67
printCopyright ( )
65
68
}
66
69
}
You can’t perform that action at this time.
0 commit comments