Configure the dependency injection container of your Symfony2 applications with a Google Doc. Crazy, ahm?
Configure your Symfony2 container from a Google Doc. Sounds crazy but it's even worse.
This bundle will let you use a Google Doc to store key-value pairs and re-use them within your Symfony2 app: this means that any human capable with interacting with a spreadsheet can play around and configure your app.
The values are "public", in the sense that you will need to share the Google Doc ("Publish to the web") so anyone with the link can access it, even though guessing the URL of the doc isn't trivial.
In any case, you should use this tecnique to store things like
- cache TTL
- products per page
- banner URLs
and so on and so fort. Do not store passwords or sensitive data there.
You can easily install this library through composer:
Simply define the config service, here we are using Redis and gvalue to store config values from Google Docs to Redis and read the cached values from a redis hash for performances:
parameters: namshi_google_doc_configuration.config.google_doc_key: 123456 services: config: class: Namshi\GoogleDocConfigurationBundle\Config\RedisConfig arguments: [@namshi_google_doc_configuration.predis, 'namshi.config', true]
The Google Doc key can be found from the URL of your Google Doc, which is something like
123456 is the key of the document.
To check the format of the doc have a look at the example one.
Then secure the 2 routes that the bundle exposes,
utility: pattern: (^/namshi/update-config)|(^/namshi/config) http_basic: provider: ...
You can then check
http://domain.example/namshi/config to check your configuration
http://domain.example/namshi/update-config to update it from
the Google Doc.
If you need to process / transform values out of the Google Do, ie. transforming
false you can simply define a
service and let it implement the TransformerInterface.
This is probably not so clean but you can live with it, for now :)