2016-07-29 16:59:58 +00:00
/ *
Node - OpenDroneMap Node . js App and REST API to access OpenDroneMap .
Copyright ( C ) 2016 Node - OpenDroneMap Contributors
This program is free software : you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation , either version 3 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program . If not , see < http : //www.gnu.org/licenses/>.
* /
2016-07-28 01:51:52 +00:00
'use strict' ;
2016-07-29 16:59:58 +00:00
let argv = require ( 'minimist' ) ( process . argv . slice ( 2 ) ) ;
if ( argv . help ) {
console . log ( `
Usage : node index . js [ options ]
Options :
- p , -- port < number > Port to bind the server to ( default : 3000 )
-- odm _path < path > Path to OpenDroneMap ' s code ( default : / c o d e )
-- log _level < logLevel > Set log level verbosity ( default : debug )
- d , -- deamonize Set process to run as a deamon
Log Levels :
error | debug | info | verbose | debug | silly
` );
process . exit ( 0 ) ;
}
2016-07-28 01:51:52 +00:00
2016-07-28 22:59:08 +00:00
let config = { } ;
2016-07-28 01:51:52 +00:00
2016-07-29 16:59:58 +00:00
// Instance name - default name for this configuration
2016-07-28 01:51:52 +00:00
config . instance = 'node-OpenDroneMap' ;
2016-07-29 16:59:58 +00:00
config . odm _path = argv . odm _path || '/code' ;
2016-07-28 01:51:52 +00:00
// Logging configuration
config . logger = { } ;
2016-07-29 16:59:58 +00:00
config . logger . level = argv . log _level || 'debug' ; // What level to log at; info, verbose or debug are most useful. Levels are (npm defaults): silly, debug, verbose, info, warn, error.
2016-07-28 01:51:52 +00:00
config . logger . maxFileSize = 1024 * 1024 * 100 ; // Max file size in bytes of each log file; default 100MB
config . logger . maxFiles = 10 ; // Max number of log files kept
config . logger . logDirectory = '' ; // Set this to a full path to a directory - if not set logs will be written to the application directory.
2016-07-29 16:59:58 +00:00
config . port = parseInt ( argv . port || argv . p || process . env . PORT || 3000 ) ;
config . deamon = argv . deamonize || argv . d ;
2016-07-28 01:51:52 +00:00
module . exports = config ;