From e924b73394654a55fe8abfa769b360fb6cfee956 Mon Sep 17 00:00:00 2001 From: Simo Kinnunen Date: Mon, 27 Jan 2014 11:07:32 +0900 Subject: [PATCH] Start auth-mock with `stf local` and make the log tag clearer. --- lib/cli.js | 20 +++++++++++++++++++- lib/roles/auth/ldap.js | 4 ++-- lib/roles/auth/mock.js | 4 ++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/cli.js b/lib/cli.js index ee8111ff..1954840c 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -262,9 +262,17 @@ program , 'device pull endpoint' , String , 'tcp://127.0.0.1:7116') + .option('--auth-port ' + , 'auth port' + , Number + , 7120) + .option('--auth-secret ' + , 'auth secret' + , String + , 'kute kittykat') .action(function() { var log = logger.createLogger('cli') - var options = cliutil.lastArg(arguments) + , options = cliutil.lastArg(arguments) // app triproxy procutil.fork(__filename, [ @@ -317,6 +325,16 @@ program .catch(function(err) { log.error('provider died', err.stack) }) + + // auth-mock + procutil.fork(__filename, [ + 'auth-mock' + , '--port', options.authPort + , '--secret', options.authSecret + ]) + .catch(function(err) { + log.error('auth-mock died', err.stack) + }) }) program.parse(process.argv) diff --git a/lib/roles/auth/ldap.js b/lib/roles/auth/ldap.js index 0a3031ad..bf640165 100644 --- a/lib/roles/auth/ldap.js +++ b/lib/roles/auth/ldap.js @@ -9,7 +9,7 @@ var ldaputil = require('../../util/ldaputil') var jwtutil = require('../../util/jwtutil') module.exports = function(options) { - var log = logger.createLogger('app') + var log = logger.createLogger('auth-ldap') , app = express() app.use(express.cookieParser()) @@ -26,7 +26,7 @@ module.exports = function(options) { }) app.post('/auth', function(req, res) { - var log = logger.createLogger('auth') + var log = logger.createLogger('auth-ldap') log.setLocalIdentifier(req.ip) switch (req.accepts(['json'])) { case 'json': diff --git a/lib/roles/auth/mock.js b/lib/roles/auth/mock.js index ca540ad8..9c6350d6 100644 --- a/lib/roles/auth/mock.js +++ b/lib/roles/auth/mock.js @@ -9,7 +9,7 @@ var jwtutil = require('../../util/jwtutil') var pathutil = require('../../util/pathutil') module.exports = function(options) { - var log = logger.createLogger('app') + var log = logger.createLogger('auth-mock') , app = express() app.set('view engine', 'jade') @@ -52,7 +52,7 @@ module.exports = function(options) { }) app.post('/api/v1/auth', function(req, res) { - var log = logger.createLogger('auth') + var log = logger.createLogger('auth-mock') log.setLocalIdentifier(req.ip) switch (req.accepts(['json'])) { case 'json':