@@ -23,10 +23,9 @@ $ npm install node-etcd@3.0.2
23
23
## Changes
24
24
25
25
- 5.0.0
26
- - Supports basic auth.
27
- - Breaking: Constructor changes
28
- - Breaking: Must provide https url to use https
29
-
26
+ - Supports basic auth, timeout, etc. See options.
27
+ - ** Breaking** : Constructor changes (see below)
28
+ - ** Breaking** : Must provide https url to use https
30
29
- 4.2.1
31
30
- Newer deasync fixes issues with iojs 3.3.0 and nodejs 4.0.0.
32
31
- 4.1.0
@@ -423,9 +422,9 @@ Provide `ca`, `cert`, `key` as options. Remember to use `https`-url.
423
422
var fs = require (' fs' );
424
423
425
424
var options = {
426
- ca: fs .readFileSync (' ca.pem' ),
427
- cert: fs .readFileSync (' cert.pem' ),
428
- key: fs .readFileSync (' key.pem' )
425
+ ca: fs .readFileSync (' ca.pem' ),
426
+ cert: fs .readFileSync (' cert.pem' ),
427
+ key: fs .readFileSync (' key.pem' )
429
428
};
430
429
431
430
var etcdssl = new Etcd (" https://localhost:4001" , options);
@@ -439,14 +438,14 @@ Pass a hash containing username and password as auth option to use basic auth.
439
438
var auth = {
440
439
user: " username" ,
441
440
pass: " password"
442
- }
441
+ };
443
442
444
443
var etcd = new Etcd (" localhost:4001" , { auth: auth });
445
444
```
446
445
447
446
## Constructor options
448
447
449
- Useful constructor options include:
448
+ Pass in a hash after server in the constructor to set options. Some useful constructor options include:
450
449
451
450
- ` timeout ` - Integer request timeout in milliseconds to wait for server response.
452
451
- ` ca ` - Ca certificate
@@ -455,6 +454,42 @@ Useful constructor options include:
455
454
- ` passphrase ` - Client key passphrase
456
455
- ` auth ` - A hash containing ` {user: "username", pass: "password"} ` for basic auth.
457
456
457
+ ``` javascript
458
+ var etcd = new Etcd (" 127.0.0.1:4001" , { timeout: 1000 , ... });'
459
+ ```
460
+
461
+ ## Debugging
462
+
463
+ Nodejs `console.log`/`console.dir` truncates output to a couple of levels -
464
+ often hiding nested errors. Use `util.inspect` to show inner errors.
465
+
466
+ ```javascript
467
+ etcd.get(' key' , function(err, val) {
468
+ console.log(require(' util' ).inspect(err, true, 10));
469
+ });
470
+
471
+ //{ [Error: All servers returned error]
472
+ // [stack]: [Getter/Setter],
473
+ // [message]: ' All servers returned error' ,
474
+ // errors:
475
+ // [ { server: ' https: // localhost:2379',
476
+ // httperror:
477
+ // { [Error: Hostname/IP doesn't match certificate's altnames: "Host: localhost. is not cert's CN: undefined"]
478
+ // [stack]: [Getter/Setter],
479
+ // [message]: 'Hostname/IP doesn\'t match certificate\'s altnames: "Host: localhost. is not cert\'s CN: undefined"',
480
+ // reason: 'Host: localhost. is not cert\'s CN: undefined',
481
+ // host: 'localhost.',
482
+ // cert:
483
+ // { subject: { C: 'USA', O: 'etcd-ca', OU: 'CA' },
484
+ // issuer: { C: 'USA', O: 'etcd-ca', OU: 'CA' } } },
485
+ // httpstatus: undefined,
486
+ // httpbody: undefined,
487
+ // response: undefined,
488
+ // timestamp: Sun Dec 27 2015 23:05:15 GMT+0100 (CET) },
489
+ // [length]: 1 ],
490
+ // retries: 0 }
491
+ ```
492
+
458
493
## FAQ:
459
494
460
495
- Are there any order of execution guarantees when doing multiple requests without using callbacks?
0 commit comments