* 3. start up the runrightfast-api-gateway-server - which is configured to route to the runrightfast-logging-server and is enforcing Hawk auth
 * 4. restart the runrightfast-logging-server while the test-harness is running and watch the server console window - no event messages should be dropped
 * 		- the client console logs the counter for the logged events, which is part of the event data
 * </pre>
 * 
 * *** ./start-server.js peforms steps 2-4 listed above - start it with node in
 * a separate window to observe server side logging
 * 
 */

'use strict';

var config = require('runrightfast-commons').config;

// runrightfast-api-gateway-server should be listening on the same port
var port = parseInt(config.param('RRF_PORT', '9000'), 10);

var loggingClient = require('..')({
	baseUrl : 'http://localhost:' + port,
	logLevel : 'WARN',
	auth : {
		hawk : {
			credentials : {
				"id" : "16e6be17452f4112b30701d5af60da4e",
				"key" : "b6dc223598764cc4bd60e87af7ce3ca0",
				"algorithm" : "sha256"
			}
		},
		logLevel : 'WARN'
	}
});
var credentials = {
	"0d110d3bd15d4795b7e14cb0fa800967" : {
		key : 'cb4251fe46a34731af3202ee8bcd5a9d',
		algorithm : 'sha256'
	}
};

var getCredentials = function(id, callback) {
	return callback(null, credentials[id]);
};

module.exports = {
	pack : {},
	servers : [ {
		port : parseInt(config.param('RRF_PORT', '8080'), 10),
		options : {
			labels : [ 'api' ],
			auth : {
				hawk : {
					scheme : 'hawk',
					defaultMode : true,
					getCredentialsFunc : getCredentials
				}
			}
		}
	} ],
	plugins : {
		'lout' : {
			endpoint : '/api/hapi/docs'
		},