Created
June 7, 2013 12:39
-
-
Save labajo/5728935 to your computer and use it in GitHub Desktop.
Node bin executor. Config parameter:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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