tribune
Version:
Holy advocate to the Roman Senate, your Tribune will ensure the Consuls have your interests in mind.
26 lines (20 loc) • 691 B
JavaScript
const url = require('url');
const TagArray = require('./tag-array');
class Endpoint {
constructor(consulServiceEndpoint) {
this.tags = new TagArray();
if (consulServiceEndpoint.Tags) {
this.tags.push(...consulServiceEndpoint.Tags);
}
const routes = this.tags.get('routes');
this.publicRoutes = routes ? routes.split(',') : [];
this.name = consulServiceEndpoint.Service;
this.id = consulServiceEndpoint.ID;
this.url = url.format({
protocol: this.tags.get('protocol') || 'http',
hostname: consulServiceEndpoint.Address,
port : consulServiceEndpoint.Port
});
}
}
module.exports = Endpoint;