-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsul.js
More file actions
31 lines (27 loc) · 728 Bytes
/
consul.js
File metadata and controls
31 lines (27 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const Consul = require('consul');
const consul = Consul(
{
defaults: {
token: process.env.CONSUL_TOKEN
},
host: process.env.CONSUL_HOST,
port: process.env.CONSUL_PORT,
promisify: true,
secure: true,
}
);
const search = async () => {
const tenantKeys = await consul.kv.keys('private/shiva/activity/activities')
await tenantKeys.forEach(async (key) => {
try {
await consul.kv.get({ recursive: false, key }).then(() => {
}).catch((err) => {
console.log(`prefix: ${key}.`)
console.log(err)
})
} catch (err) {
console.log(err)
}
});
}
search();