gma / nesta

File Based CMS and Static Site Generator
http://nestacms.com
MIT License
902 stars 121 forks source link

Add custom configuration options #127

Closed davejlong closed 10 years ago

davejlong commented 11 years ago

There should be a way to add additional configuration options to config.yml and reference them as global variables.

gma commented 11 years ago

Hi. Can you expand on why, maybe with an example of what you want to do, and why it would be better than just using ruby in app.rb?

David Long notifications@github.com wrote:

There should be a way to add additional configuration options to config.yml and reference them as global variables.

— Reply to this email directly or view it on GitHub.

davejlong commented 11 years ago

So for example, I am creating sites that use Google analytics and multiple domains. When doing this Google analytics wants the account id and the primary domain passed. Rather than having the account id in the config file and setting the primary domain as a variable in app.rb, I'd rather have all of my config in the yml file.

gma commented 11 years ago

A fair use case, thanks. I'm thinking that the from_yaml and from_environment methods in the Nesta::Config class could be wrapped by a public method that you could call to pull a value out of the config file. Or perhaps it should be possible to ask the Config class for any value, regardless of whether or not it's one of Nesta's built-in config variables, and just let it look to see whether it can find the appropriate value in the environment, or in the Yaml file.

davejlong commented 11 years ago

It would make sense to allow it to ask for any variable. If the variable doesn't exist then return nil.

gma commented 10 years ago

Closing this as its superseded by #136.