Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-04-30 11:26:43 -0400
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-05-01 09:44:55 -0400
commitea30e94527d746df7fd805b2d4a981d5c8771d5f (patch)
treee4220eee18f95b0f46ba1c37209cec6fbe511d0c
parent25cb1f62c1adaa136ff0e0f769e33d5180736b3b (diff)
downloadliza-ea30e94527d746df7fd805b2d4a981d5c8771d5f.tar.gz
liza-ea30e94527d746df7fd805b2d4a981d5c8771d5f.tar.bz2
liza-ea30e94527d746df7fd805b2d4a981d5c8771d5f.zip
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.
-rw-r--r--conf/vanilla-server.json3
-rw-r--r--src/server/daemon/Daemon.js17
-rw-r--r--src/server/daemon/controller.js8
3 files changed, 17 insertions, 11 deletions
diff --git a/conf/vanilla-server.json b/conf/vanilla-server.json
index 41e90b8..452dc4c 100644
--- a/conf/vanilla-server.json
+++ b/conf/vanilla-server.json
@@ -49,7 +49,8 @@
"remote": {
"host": "localhost",
"domain": ""
- }
+ },
+ "noResultsUrl": ""
},
"c1export": {
"host": "localhost",
diff --git a/src/server/daemon/Daemon.js b/src/server/daemon/Daemon.js
index 282197f..7a13769 100644
--- a/src/server/daemon/Daemon.js
+++ b/src/server/daemon/Daemon.js
@@ -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(),
];
diff --git a/src/server/daemon/controller.js b/src/server/daemon/controller.js
index 3171315..b8a0950 100644
--- a/src/server/daemon/controller.js
+++ b/src/server/daemon/controller.js
@@ -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