new app, and some mozsvc notes

Ryan Kelly rkelly at mozilla.com
Wed Oct 26 19:54:19 PDT 2011


Hi All,


  I have implemented another simple app on top of pyramid, cornice and
mozsvc.  It's called "keyretrieval", it's very simple, and it's the
server-side component of this proposal:

    https://wiki.mozilla.org/Services/Sync/KeyRetrieval

  Code is here:

    https://wiki.mozilla.org/Services/Sync/KeyRetrieval


  The process was pretty painless, but it's highlighted some things to
think about for mozsvc and related stacks.


  1)  configuration loading and parsing


  The mozsvc package has its own config-file parsing machinery, with
some nice handling of nested sections and include files.  But it's
currently separate from the configuration of pyramid itself and other
related services.

  I implemented the following code to flatten the loaded config file
into the pyramid settings dictionary, so that you can specify everything
in the one place and have it picked up automatically by the different
components:


https://github.com/mozilla-services/keyretrieval/blob/master/keyretrieval/__init__.py#L18

  It would be good to have all this config-file-loading boilerplate
extracted into a utility function in mozsvc.config, but I'm not sure
exactly what the API should look like.


  2)  pluggable components

  The app currently stores all its data in memory, but it should be
writing it out to a pluggable storage backend configured from the .ini
file.  In other words, it should have something like the plugin registry
load_and_configure() from server-core.

  It looks like Ben is doing something similar in queuey with zope
interfaces and a configure_from_settings function:


https://github.com/mozilla-services/queuey/blob/master/queuey/storage/__init__.py

  It it worth providing some helpers for this in mozsvc?


 Thoughts?


   Cheers,

      Ryan






More information about the Services-dev mailing list