Comments (5)
Yeah, the common options section should be more explicit, it basically works for everything except the client constructor.
from node-consul.
So there is no way to globally define the consul client url to use at the client level? It must be passed to each function/query?
from node-consul.
You can define all these options at the client level: https://github.com/silas/node-consul#init
All these options must be defined at the method level: https://github.com/silas/node-consul#common-options
So you can define a host, but not a dc, at the client level.
I expect the reason you're getting undefined in your second example is because the local (default) dc doesn't have the key set.
You could confirm this by printing the actual res:
consul = require("consul")({
host: "s-consul-server-01"
})
consul.kv.get {key: "tenant/t1"}, (err, r, res) ->
console.log "--- err=", err
console.log "--- r=", r
console.log "--- res=", res.statusCode, res.headers, res.body
from node-consul.
It would be really nice to be able to define default options at the client level, especially things like the acl token.
from node-consul.
Released to npm in version >= 0.16.0
.
Example
var consul = consul({ defaults: { token: '123' } });
You can set these defaults for now:
Lines 11 to 19 in e0d1835
from node-consul.
Related Issues (20)
- access to keys response HOT 3
- TypeError: consul_1.default is not a constructor HOT 1
- TypeScript Support for consul.query HOT 1
- There is no accessible history.md or changelog.md file HOT 1
- Consul queries providing `tag` are deprecated HOT 2
- Long Polling index should be verified > 0 after initial response
- Reset index of watch job if index ever decreases HOT 1
- Can't invoke "new Consul()" HOT 1
- Can't invoke "new Consul()" constructor in typescript app HOT 1
- Release docs? HOT 4
- Typescript support for client.watch HOT 1
- Typescript suppor for grpc healthcheck's HOT 1
- Add Typescript support HOT 2
- Grype scanner found all this vulnerabilities in the library CVE-2018-25046, CVE-2020-13250, CVE-2021-38698, CVE-2022-40716, CVE-2020-7219, CVE-2020-28053, CVE-2021-3121, CVE-2021-37219 HOT 1
- support for kv.List HOT 2
- extend host:port to support multiple agents HOT 4
- Don't set x-consul-token if it's undefined
- how to watch service? HOT 1
- Grpc Check register request ignores `tls_skip_verify` HOT 4
- Question about the usage of "end" function in watch.js HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-consul.