Skip to content

Instantly share code, notes, and snippets.

@labajo
Created June 7, 2013 12:39
Show Gist options
  • Save labajo/5728935 to your computer and use it in GitHub Desktop.
Save labajo/5728935 to your computer and use it in GitHub Desktop.
Node bin executor. Config parameter:
npm install --save optimist
Ejecución por line de comandos:
./tdaf-api-authserver --configFile=./config
o
./tdaf-api-authserver --configFile=./config/config.dev
o
./tdaf-api-authserver
(Usa la configuración por defecto que se haya establecido en index.js.)
Ejecución desde webstorm:
Lanzar el index.js como siempre, pero añadiendo --ide como application parameters:
Ejemplos:
--ide --configFile=./config
o
--ide --configFile=./config/config.dev
o
--ide
(Usa la configuración por defecto que se haya establecido en index.js.)
var di = require('ng-di');
require('./lib/tdaf-api-authserver');
var defaultConfig = './config/config.dev';
var config;
var argv = require('optimist').default('configFile', defaultConfig).boolean('ide').argv;
var launch = function launch(configuration) {
console.log(configuration);
config = require(configuration);
di.module('AuthServer').run(function ($log, $server) {
$server.start();
$log.info('AuthServer running');
}).config(function ($logProvider) {
console.log('Hola');
$logProvider.debugEnabled(config.debug);
});
di.injector(['AuthServer']);
}
if(argv.ide) {
launch(argv.configFile);
}
module.exports.launch = exports.launch= launch;
module.exports.defaultConfig = exports. defaultConfig = defaultConfig;
#!/usr/bin/env node
var main = require('../index');
var argv = require('optimist').default('configFile', main.defaultConfig).argv;
main.launch(argv.configFile);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment