diff options
author | Mike Gerwitz <gerwitzm@lovullo.com> | 2017-09-08 14:18:16 -0400 |
---|---|---|
committer | Mike Gerwitz <gerwitzm@lovullo.com> | 2017-09-08 14:18:16 -0400 |
commit | ed7e5fc547055e3406f9fe1301a31a486d3116ec (patch) | |
tree | 4f7081ebeb8f31d6db271fe20e537ec1bd5306b3 /bin | |
parent | 73354e39d02f52b329a96f7a16409e787e9c7b26 (diff) | |
download | liza-ed7e5fc547055e3406f9fe1301a31a486d3116ec.tar.gz liza-ed7e5fc547055e3406f9fe1301a31a486d3116ec.tar.bz2 liza-ed7e5fc547055e3406f9fe1301a31a486d3116ec.zip |
conf: Specify relative/absolute path to daemon
This isn't ideal, but will allow using daemons classes from anywhere
on disk.
* bin/server.js: Interpret daemon path as relative to conf file path.
* conf/vanilla-server.json: Use relative path to `DevDaemon'.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/server.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/server.js b/bin/server.js index c1e9f9c..6929fca 100644 --- a/bin/server.js +++ b/bin/server.js @@ -21,7 +21,8 @@ 'use strict'; -const fs = require( 'fs' ); +const fs = require( 'fs' ); +const path = require( 'path' ); const { conf: { @@ -39,6 +40,7 @@ const conf_path = ( : '' ) || __dirname + '/../conf/vanilla-server.json'; +const conf_dir = path.dirname( conf_path ); ConfLoader( fs, ConfStore ) .fromFile( conf_path ) @@ -49,8 +51,10 @@ ConfLoader( fs, ConfStore ) ] ) ) .then( ([ name, daemon, conf ]) => { - greet( name, daemon ); - return server.daemon[ daemon ]( conf ).start(); + const daemon_path = conf_dir + '/' + daemon; + + greet( name ); + return require( daemon_path )( conf ).start(); } ) .catch( e => { console.error( e.stack ); @@ -58,9 +62,8 @@ ConfLoader( fs, ConfStore ) } ); -function greet( name, daemon ) +function greet( name ) { console.log( `${name} (liza-${version})`); console.log( `Server configuration: ${conf_path}` ); - console.log( `Starting with ${daemon}, pid ${process.pid}` ); } |