Account for absolute paths in configuration
* bin/server.js: Resolve absolute paths as such. (_resolvePath): Add function.master
parent
4dda515821
commit
38539ca80b
|
@ -52,8 +52,8 @@ ConfLoader( fs, ConfStore )
|
|||
] ) )
|
||||
.then( ([ name, daemon, pidfile, conf ]) =>
|
||||
{
|
||||
const daemon_path = conf_dir + '/' + daemon;
|
||||
const pid_path = conf_dir + '/' + ( pidfile || ".pid" );
|
||||
const daemon_path = _resolvePath( conf_dir, daemon );
|
||||
const pid_path = _resolvePath( conf_dir, ( pidfile || ".pid" ) );
|
||||
|
||||
writePidFile( pid_path );
|
||||
greet( name, pid_path );
|
||||
|
@ -66,6 +66,23 @@ ConfLoader( fs, ConfStore )
|
|||
} );
|
||||
|
||||
|
||||
/**
|
||||
* Produce an absolute path if `path` is absolute, otherwise a path relative
|
||||
* to the configuration directory
|
||||
*
|
||||
* @param {string} conf_path configuration path (for relative `path`)
|
||||
* @param {string} path path to resolve
|
||||
*
|
||||
* @return resolved path
|
||||
*/
|
||||
function _resolvePath( conf_path, path )
|
||||
{
|
||||
return ( path[ 0 ] === '/' )
|
||||
? path
|
||||
: conf_path + '/' + path;
|
||||
}
|
||||
|
||||
|
||||
function writePidFile( pid_path )
|
||||
{
|
||||
fs.writeFile( pid_path, process.pid );
|
||||
|
|
Loading…
Reference in New Issue