1
0
Fork 0

Integrate noResultsUrl configuration

This is not the ideal implementation.  Instantiation of RatingService and
such should be moved out of the controller entirely, but we don't have the
time for that right now.
master
Mike Gerwitz 2018-04-30 11:26:43 -04:00
parent 25cb1f62c1
commit ea30e94527
3 changed files with 17 additions and 11 deletions

View File

@ -49,7 +49,8 @@
"remote": {
"host": "localhost",
"domain": ""
}
},
"noResultsUrl": ""
},
"c1export": {
"host": "localhost",

View File

@ -113,7 +113,8 @@ module.exports = AbstractClass( 'Daemon',
this._createDebugLog(),
this._createAccessLog(),
this._conf.get( 'skey' ),
] ).then( ([ debug_log, access_log, skey ]) =>
this._conf.get( 'services.rating.noResultsUrl' ),
] ).then( ([ debug_log, access_log, skey, no_results_url ]) =>
{
this._debugLog = debug_log;
this._accessLog = access_log;
@ -122,7 +123,7 @@ module.exports = AbstractClass( 'Daemon',
this._rater = liza.server.rater.ProcessManager();
this._encService = this.getEncryptionService();
this._memcache = this.getMemcacheClient();
this._routers = this.getRouters( skey );
this._routers = this.getRouters( skey, no_results_url );
} )
.then( () => this._startDaemon() );
},
@ -182,14 +183,16 @@ module.exports = AbstractClass( 'Daemon',
},
'protected getProgramController': function( skey )
'protected getProgramController': function( skey, no_results_url )
{
var controller = require( './controller' );
controller.rater = this._rater;
controller.rater = this._rater;
controller.no_results_url = no_results_url || "";
if ( skey )
{
controller.skey = skey;
controller.skey = skey;
}
return controller;
@ -276,10 +279,10 @@ module.exports = AbstractClass( 'Daemon',
'abstract protected getEncryptionService': [],
'protected getRouters': function( skey )
'protected getRouters': function( skey, no_results_url )
{
return [
this.getProgramController( skey ),
this.getProgramController( skey, no_results_url ),
this.getScriptsController(),
this.getClientErrorController(),
];

View File

@ -100,8 +100,9 @@ var sflag = {};
// TODO: kluge to get liza somewhat decoupled from lovullo (rating module)
exports.rater = {};
exports.skey = "";
exports.rater = {};
exports.skey = "";
exports.no_results_url = "";
exports.init = function( logger, enc_service, conf )
@ -125,10 +126,11 @@ exports.init = function( logger, enc_service, conf )
server_cache = _createCache( server );
server.init( server_cache, exports.rater );
// TODO: do none of this if no_results_url is provided
const createSubmitDapi = request => HttpDataApi
.use( HttpDataApiUrlData( [ 'quote_id' ] ) )
(
'http://localhost:2222',
exports.no_results_url,
'PUT',
NodeHttpImpl