Athens: Ability to set MongoDB database name

Created on 12 Nov 2018  路  4Comments  路  Source: gomods/athens

Is your feature request related to a problem? Please describe.

I deployed athens to heroku. If I wanted to use the sandbox mLab offering of mongoDB for example I'd have to take their automatically generated database name (something like heroku_aowd89adw which wouldn't be athens. athens is currently required by this storage driver implementation.

At the moment we hardcode the database name as athens and there's a TODO to make a better solution.

Describe the solution you'd like

Either creating environment variables for the database inline with our current environment variable naming or my preffered solution is reading the [/database] from mgo.ParseURL

Describe alternatives you've considered

Leave it as it'd be and force users to have athens as their database name.

Additional context

Some discussion around the subject https://gophers.slack.com/archives/C9LRAQN8N/p1542026809792000

bug good first issue storage

Most helpful comment

@manugupt1 yeah mate I'll put the PR in tomorrow or later tonight, just been busy recently sorry.

All 4 comments

I would go with this

  • use mgo to parse out db name in mongo pkg so we don't bloat config package with unnecessary dependencies
  • if info.db is not set then use newly introduced config.Mongo.DefaultDBName which is set by ENV, is not required and defaults to athens

this way we give a solution for people preferring one way or another at the same time

I'll take this for myself!

@chriscoffee Are you still on this?

@manugupt1 yeah mate I'll put the PR in tomorrow or later tonight, just been busy recently sorry.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sidprak picture sidprak  路  3Comments

robjloranger picture robjloranger  路  4Comments

leitzler picture leitzler  路  3Comments

arschles picture arschles  路  4Comments

weitangli picture weitangli  路  3Comments