diaspora/diaspora — pull request #3585 by MrZYX (2012-09-16 18:28:15+00:00)
Title: New configuration system

This is an "early look pull request" to determine if even wanted, the architecture I've chosen actually makes any sense etc.

*Disclaimer:* This isn't runnable and haven't executed it yet a single time (preserving that for at least some TDD while writing specs ;) ), so I'm sure there are even syntax errors in it. Sorry Travis.

## About

EnvironmentConfiguration and AppConfig is replaced by a unified more flexible system. application.yml is now diaspora.yml and completely restructured, grouping related settings in categories and giving better names to some settings.

All settings can now be specified and be overridden by environment variables, the conversion scheme is explained at the top of the diaspora.yml example. My experience with Heroku is still low but I hope this makes it possible to do a complete transparent heroku configuration without special hacks in the code.

## Environment variable changes (TODO)
### deprectated
### removed
### renamed

## Cavehats

Using a proxy object to allow for access to nested settings leads to one major problem I'm not really happy with: Though Rubys awesome metaprogramming capabilities there are only two things false in the Ruby wold, NilClass and FalseClass. Even subclasses of these classes are true. This leads two major issues: if you put the proxy object into an if it's always true, and since it's always true the nil || 'default' doesn't work anymore. For the first problem my workaround is to check if the called method ends with ? and return the target of the proxy if so, this yields constructs like if AppConfig.mails_enabled? working, while if AppConfig.mails_enabled being always true. For the or hack I haven't found another workaround than calling the getter of the proxy object.

## Todo

* Specs
* Docs
* Lots of testing if this actually works everywhere as it should
* Cleanup unused settings
* Unify pod url/uri handling in the whole code
* Feedback :)