progrium / ginkgo

Python service microframework
http://ginkgo.readthedocs.org
MIT License
325 stars 51 forks source link

change RootService to Context, add configuration #23

Closed progrium closed 12 years ago

progrium commented 12 years ago

Context should be the top level gservice object that a Runner will create to start an application. It should be responsible for parsing a configuration file if provided, or taking/overriding with a configuration dictionary (although the code should live in the config module). This means it should also run the service factory in the configuration.

It should also own the named global services. The _main_services in Service should live in Context. Services should have a reference to the Context (all services live within a context).

ultimately, you should be able to instantiate a gservice application by creating a Context instance. For example:

app1 = Context(file='/path/to/app1.conf.py') app2 = Context(file='/path/to/app2.conf.py')

Allowing you to write functional tests of interacting applications in the same process.

progrium commented 12 years ago

I forgot to mention, this depends on config getting namespaces: https://github.com/progrium/gservice/issues/28

progrium commented 12 years ago

The basic idea of Context evolved into the top level container service Process in 0.5.0. Configuration is now represented in an object with a default global singleton that will be associated with a Process.