AppConfig.get
AppConfig.get($key, $default='') -> any
Description
Get a value for the given $key
from config/app.jcon
, under the app
section.
You can use .
to safely read 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 social: @myusername } } }
In THT:
AppConfig.get('numArticlesOnHomePage') //= 15 AppConfig.get('showBioInFooter') //= true AppConfig.get('contact').email //= 'hello@example.com' AppConfig.get('contact.social') //= '@myusername'