MCPcopy Create free account
hub / github.com/elestio/cloudgate / ProcessCommandLine

Function ProcessCommandLine

modules/tools.js:538–993  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

536
537module.exports.ProcessCommandLine = ProcessCommandLine;
538function ProcessCommandLine(argv)
539{
540 const memory = require('../modules/memory');
541
542 if (argv.h || argv.help) {
543 console.log([
544 '',
545 'USAGE: cloudgate [path] [options]',
546 '',
547 '[GENERAL]',
548 ' --memstate [path] path pointing to your memorystate.json, optional',
549 ' -r --rootfolder [path] root folder for your app',
550 ' -c --cores [nbCores] Number of CPU cores to use (default: ALL cores), Eg.: --cores 4',
551 ' -p --port [port] Port to use [8080]',
552 ' -oc --outputcache [0 or 1] Default is 0, disabled. When enabled this will cache all GET requests until file is changed on disk.',
553 ' -h --help Print this list and exit.',
554 ' -v --version Print the version and exit.',
555 ' -w --watch Activate file change watch to auto invalidate cache [default: disabled]',
556 ' -d --debug Activate the console logs for debugging',
557 //' -a Address to use [0.0.0.0]', //when used we can't get the visitor ip!
558 '',
559 '[SSL]',
560 ' -S --ssl Enable https.',
561 ' --sslport SSL Port (default: 443)',
562 ' --ssldomain Domain name on which you want to activate ssl (eg: test.com)',
563 ' --sslcert optional path to your SSL cert. E.g: /etc/letsencrypt/live/yourdomain.com/cert.pem',
564 ' --sslkey optional path to your SSL key. E.g: /etc/letsencrypt/live/yourdomain.com/privkey.pem',
565 '',
566 '[ADMIN]',
567 ' --admin 1 Enable Admin Remote API (default: disabled)',
568 ' --adminpath /cgadmin Declare the virtual path of the admin api',
569 ' --admintoken XXXXXXXX The admin token to use for authentication of the REST API & Websocket',
570 '',
571 '[CLUSTER]',
572 ' --master Declare this host as the master',
573 ' --salve [Master IP or Domain]:[Port]@[Token] Declare this host as a slave connecting to a master',
574 //' -C --cert Path to ssl cert file (default: cert.pem).',
575 //' -K --key Path to ssl key file (default: key.pem).',
576 '',
577 '[APPS]',
578 '--list return an array of loaded apps path',
579 '--load [path] Load the app located in the target path, the folder must contain appconfig.json',
580 '--unload [path] Unload the app located in the target path',
581 '--create [path] Create a new app based on a template in the target path'
582
583 ].join('\n'));
584
585 process.exit();
586 }
587
588 if (argv.create) {
589
590 var targetPath = argv.create;
591 //check if the folder exist to avoid accidental overwrite
592 if (fs.existsSync(targetPath) && !(this.isDirEmpty(targetPath))) {
593 console.log("This folder already exist and contains files, to avoid overwriting please provide a new path to be created");
594 process.exit();
595 }

Callers

nothing calls this directly

Calls 1

ExecuteQueryFunction · 0.70

Tested by

no test coverage detected