mirror of https://github.com/pelias/api.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
655 B
49 lines
655 B
8 years ago
|
'use strict';
|
||
|
|
||
|
const _ = require('lodash');
|
||
|
|
||
|
class ServiceConfiguration {
|
||
|
constructor(name, config) {
|
||
|
if (_.isEmpty(name)) {
|
||
|
throw 'name is required';
|
||
|
}
|
||
|
|
||
|
this.name = name;
|
||
|
this.baseUrl = config.url;
|
||
|
this.timeout = config.timeout || 250;
|
||
|
this.retries = config.retries || 3;
|
||
|
|
||
|
}
|
||
|
|
||
|
getName() {
|
||
|
return this.name;
|
||
|
}
|
||
|
|
||
|
getBaseUrl() {
|
||
|
return this.baseUrl;
|
||
|
}
|
||
|
|
||
|
getUrl() {
|
||
|
return this.baseUrl;
|
||
|
}
|
||
|
|
||
|
getRetries() {
|
||
|
return this.retries;
|
||
|
}
|
||
|
|
||
|
getTimeout() {
|
||
|
return this.timeout;
|
||
|
}
|
||
|
|
||
|
getParameters() {
|
||
|
return {};
|
||
|
}
|
||
|
|
||
|
getHeaders() {
|
||
|
return {};
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
module.exports = ServiceConfiguration;
|