Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nano options lost in DB scope #28

Open
tlvince opened this issue Oct 29, 2015 · 4 comments
Open

nano options lost in DB scope #28

tlvince opened this issue Oct 29, 2015 · 4 comments

Comments

@tlvince
Copy link
Contributor

tlvince commented Oct 29, 2015

If you pass in a nano config as the url, e.g. to set requestDefaults (#14):

bootstrap({
  url: 'http://localhost:5984',
  requestDefaults: {
    auth: {
      user: 'admin',
      pass: 'admin'
    }
  }
}, 'path/to/fs', cb)

requestDefaults is lost after nano.use, for example in secure:

// ...
var dbname = utils.mapDbName(filename, options)
var db = couch.use(dbname)
console.log('couch: ', couch.config, '\ndb: ', db.config)
// =>
// couch:  { url: 'http://localhost:5984',
//  requestDefaults: { jar: false, auth: { user: 'admin', pass: 'admin' } },
//  defaultHeaders: { 'X-Couch-Full-Commit': 'true' } } 
// db:  { url: 'http://localhost:5984', db: '_users' }

In this case, this will cause subsequent requests to 401 (You are not authorized to access this db.).

Perhaps this is an issue with nano itself (apache/nano#278)?

@jo
Copy link
Owner

jo commented Nov 3, 2015

This is an interesting issue. Will investigate. This might be a bug in nano, but apache/nano#278 is a different one.

@jo
Copy link
Owner

jo commented Nov 3, 2015

Seems like this is not nanos problem

@jo
Copy link
Owner

jo commented Nov 3, 2015

db.config does not get the initial config but is only a stub with url and db, see here: https://github.com/dscape/nano/blob/master/lib/nano.js#L693

Nonetheless the config should be used like tested here: apache/nano#296

@tlvince
Copy link
Contributor Author

tlvince commented Nov 4, 2015

Sorry, so was this an issue with the way I was calling it or something in nano-option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants