Version: v0.7.1 - Beta.  We welcome contributors & feedback.

Config.get

Config.get($key, $default = '') -> any

Description

Get a value for the given $key from config/app.jcon, under the app section .

You can use > to select nested keys. (e.g. 'key1 > subkey2')

If the key does not exist, the $default will be returned.

Example app.jcon:

{
    tht: {
        ...
    }

    app: {
        numArticlesOnHomePage: 15
        showBioInFooter: true
        contact: {
            email: hello@example.com
            twitter: @myusername
        }
    }
}

In THT:

Config.get('numArticlesOnHomePage')
//= 15

Config.get('showBioInFooter')
//= true

Config.get('contact').email
//= 'hello@example.com'

Config.get('contact > twitter')
//= '@myusername'

See Also