Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@logzio-node-toolbox/consul
Advanced tools
easy to use warper for consul to register to service discovery and get, merge and watch keys
import { Consul } from '@logzio-node-toolbox/consul';
const consul = new Consul({ port: 18500, host: '127.0.0.1', baseUrl = 'some_base_url' });
initialized params:
receive same params as validateOptions and will merge with th one passed to the initializer
await consul.validateConnected(validateOptions)
const { key, value } = await consul.get('somepath/config.json')
// if have base path will fetch 'some_base_url/somepath/config.json'
await consul.set({key: 'somepath/config.json', value: {some: "value"}})
// if have base path will set to 'some_base_url/somepath/config.json'
await consul.keys('somepath/config.json')
it will fetch current values will deep merge all keys and set it
await consul.merge({key: 'somepath/config.json', value: {toOverride: "newValue" }})
options - same watchOptions object as the initializer ( will merge them together)
await consul.watch({
key: 'somepath/config.json',
onChange: ({key, value}) => {
console.log(key)
console.log(value) // new values
},
onError:(err) => {
console.log(err)
},
options
})
options - same as registerRetryOptions object as the initializer ( will merge them together)
interface RegisterData {
meta?: AnyObject;
checks?: AnyObject;
address?: string;
id?: string;
name?: string;
port?: number;
}
await consul.register({
data,
options
})
options - same as registerRetryOptions object as the initializer ( will merge them together)
interface RegisterData {
meta?: AnyObject;
checks?: AnyObject;
address?: string;
id?: string;
name?: string;
port?: number;
}
await consul.register({
data,
interval: 3000,
onError:(err) => {
console.log(err)
},
options
})
options - same as registerRetryOptions object as the initializer ( will merge them together)
await consul.close(options)
extend consul to work on multiple keys and merged config
import { MultiConsul } from '@logzio-node-toolbox/consul';
const consul = new MultiConsul({ port: 18500, paths:['config1', 'config2', 'config3'] });
/*
config1 in consul:
{
"key1": "value1"
key2": "value1"
key3": "value1"
}
config2 in consul:
{
key2": "value2"
}
// no config 3
*/
const values = await consul.getAll() // {key1: value1, key2: value2, key3: value1};
watchAll(({ key, value, changedValue }) => {
/* settings new consul file config3
{ key: value3 }
will invoke watch with
key: config3
changedValue: { key: value3 }
values: {key1: value1, key2: value2, key3: value3};
*/
})
FAQs
Consul easy use for json configs and service discovery
The npm package @logzio-node-toolbox/consul receives a total of 2,033 weekly downloads. As such, @logzio-node-toolbox/consul popularity was classified as popular.
We found that @logzio-node-toolbox/consul demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.