Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/namshi/google-doc-configuration-bundle
Configure the dependency injection container of your Symfony2 applications with a Google Doc. Crazy, ahm?
https://github.com/namshi/google-doc-configuration-bundle
Last synced: 1 day ago
JSON representation
Configure the dependency injection container of your Symfony2 applications with a Google Doc. Crazy, ahm?
- Host: GitHub
- URL: https://github.com/namshi/google-doc-configuration-bundle
- Owner: namshi
- Created: 2014-01-10T13:10:00.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-09-21T06:03:19.000Z (about 10 years ago)
- Last Synced: 2024-04-14T12:15:19.497Z (7 months ago)
- Language: PHP
- Size: 287 KB
- Stars: 0
- Watchers: 34
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GoogleDocConfigurationBundle
> 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](https://support.google.com/docs/answer/37579?hl=en)")
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 URLsand so on and so fort. **Do not** store passwords or sensitive data
there.## Installation
You can easily install this library through
[composer](https://packagist.org/packages/namshi/google-doc-configuration-bundle):```
"namshi/google-doc-configuration-bundle": "dev-master"
```## Configuration
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:``` yaml
parameters:
namshi_google_doc_configuration.config.google_doc_key: 123456services:
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
`https://docs.google.com/a/namshi.com/spreadsheet/ccc?key=123456&usp=drive_web#gid=0`, where
`123456` is the key of the document.To check the format of the doc have a look at the [example one](https://docs.google.com/spreadsheet/ccc?key=0Au4X4OwTcvrSdG5oZkFXMXM5SUl4YVF5bDV2NmZiSmc&usp=sharing).
Then secure the 2 routes that the bundle exposes,
in the `security.yml`:``` yaml
utility:
pattern: (^/namshi/update-config)|(^/namshi/config)
http_basic:
provider: ...
```You can then check `http://domain.example/namshi/config` to check your configuration
and `http://domain.example/namshi/update-config` to update it from
the Google Doc.## Storing the config in different ways
We use [Redis](https://github.com/namshi/google-doc-configuration-bundle/blob/127a9df511437764d2e33f8fc8d36c38d9ac5f5a/src/Namshi/GoogleDocConfigurationBundle/Config/RedisConfig.php)
but you are free to implement the
[ConfigInterface](https://github.com/namshi/google-doc-configuration-bundle/blob/127a9df511437764d2e33f8fc8d36c38d9ac5f5a/src/Namshi/GoogleDocConfigurationBundle/Config/ConfigInterface.php)
and have fun with it.## Transforming values
If you need to process / transform values out of the Google Do, ie. transforming
`"false"` to `false` you can simply define a `namshi_google_doc_configuration.transformer`
service and let it implement the [TransformerInterface](https://github.com/namshi/google-doc-configuration-bundle/blob/127a9df511437764d2e33f8fc8d36c38d9ac5f5a/src/Namshi/GoogleDocConfigurationBundle/Config/TransformerInterface.php).This is probably not so clean but you can live with it, for now :)
## Tests
![b****-please](http://galeri2.uludagsozluk.com/342/bitch-please_459292.jpg)