langalex / couch_potato

Ruby persistence layer for CouchDB.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom port for database

aL3xa opened this issue · comments

In the Rails app I'm working on I've set up a test CouchDB server running on port 5985. Although I can provide a custom database name/URL with:

> CouchPotato::Config.database_name = "http://127.0.0.1:5985/foo"
=> "http://127.0.0.1:5985/foo"

it keeps reverting back to default 5984:

> CouchPotato.database
=> #<CouchPotato::Database @root="http://127.0.0.1:5984/foo">

Any ideas how to fix this?

do you have a file couchdb.yml in /config? usually you would configure your database in there.

Sure, I did and it didn't pick it up for test environment (or any other FWIW). Here's my config:

default: &default
  protocol: 'http'
  host: '127.0.0.1'
  port: 5984
  prefix: ''
  suffix: ''
  default_language: :javascript

development:
  <<: *default

test:
  <<: *default
  port: 5985

production:
  <<: *default

Can you replicate the code I specified above?

as you can see here the config file only looks for a key database - this can be either the database name or the full url. no port, prefix etc. pull requests welcome.