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

Already on GitHub? Sign in to your account

Explicit configuration #8

Open
superbobry opened this Issue Mar 10, 2011 · 5 comments

Comments

Projects
None yet
3 participants
Collaborator

superbobry commented Mar 10, 2011

Currently minimongo looks for configuration file in a number of special places: .config, .app_config etc.

This sure is a nice way of doing things, but why not add a shortcut for changing the defaults, so we don't force any specific locations. The idea is similar to what mongoengine offers:

from minimongo import configure

# a) manual configuration
configure(host="...", port="...")
# b) from a module
import app_config; configure(app_config)

What do you think?

Collaborator

superbobry commented Mar 11, 2011

Draft implementation: superbobry/minimongo@ef36b24

Owner

slacy commented Mar 14, 2011

I like this idea, the only question I had from an app developer's perspective is something like:

"I only want to declare my host & port connection parameters once. Where do I put the call to configure()" Likely it will end up in the global scope in some imported file or, if you're using a web framework like I am, in some framework-specific file that's imported every time.

I think we can address this in the docs, but it's something to think about.

I've been reading some discussion on the Pyramid mailing list (http://groups.google.com/group/pylons-devel) and most of the users there are connecting to their DB with each request. Thought this was interesting, but since mod_wsgi gives long-lived processes, I actually like minimongo's current approach of connecting at process startup.

Collaborator

superbobry commented Mar 14, 2011

Personally, I'm not happy with the way configure() is implemented at the moment -- I'll take a look at Flask and see if we can borrow some of the ideas from it :)

aidan commented Dec 7, 2011

Did this go anywhere? I'm using minimongo in a flask project and config's a bit of a pain

Collaborator

superbobry commented Dec 7, 2011

Not really, minimongo is not actively developed anymore ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment