Ghost/core/server/services
Aileen Nowak 63642fd8ad YAML settings loader and parser
closes #9528

These code changes introduce a YAML parser which will load and parse YAML files from the `/content/settings` directory. There are three major parts involved:

1. `ensure-settings.js`: this fn takes care that on bootstrap, the supported files are present in the `/content/settings` directory. If the files are not present, they get copied back from our default files. The default files to copy from are located in `core/server/services/settings`.

2. `loader.js`: the settings loader reads the requested `yaml` file from the disk and passes it to the yaml parser, which returns a `json` object of the file. The settings loader throws an error, if the file is not accessible, e. g. because of permission errors.

3. `yaml-parser`: gets passed a `yaml` file and returns a `json` object. If the file is not parseable, it returns a clear error that contains the information, what and where the parsing error occurred (e. g. line number and reason).

- added a `get()` fn to settings services, that returns the settings object that's asked for. e. g. `settings.get('routes').then(()...` will return the `routes` settings.
- added a `getAll()` fn to settings services, that returns all available settings in an object. The object looks like: `{routes: {routes: {}, collections: {}, resources: {}}, globals: {value: {}}`, assuming that we have to supported settings `routes` and `globals`.

Further additions:
- config `contentPath` for `settings`
- config overrides for default `yaml` files location in `/core/server/services/settings`

**Important**: These code changes are in preparation for Dynamic Routing and not yet used. The process of copying the supported `yaml` files (in this first step, the `routes.yaml` file) is not yet activated.
2018-04-15 19:40:22 +02:00
..
apps Moved zip folder, read csv and package-json to lib/fs 2017-12-14 22:07:53 +01:00
auth Sorted out the mixed usages of include and withRelated (#9425) 2018-02-15 10:53:53 +01:00
channels 🐛Fixed author page has only shown primary author posts 2018-04-10 22:56:25 +02:00
mail Moved labs, auth, permissions, settings, mail, themes to services (#9339) 2017-12-14 03:01:23 +01:00
permissions Sorted out the mixed usages of include and withRelated (#9425) 2018-02-15 10:53:53 +01:00
route Rework route service to prevent circular dependencies (#9229) 2017-11-09 13:58:22 +00:00
rss Multiple authors (#9426) 2018-03-27 15:16:15 +01:00
settings YAML settings loader and parser 2018-04-15 19:40:22 +02:00
themes 🐛 Reload translations if active theme get's overridden (#9392) 2018-01-12 09:19:28 +00:00
url Multiple authors (#9426) 2018-03-27 15:16:15 +01:00
labs.js Moved labs, auth, permissions, settings, mail, themes to services (#9339) 2017-12-14 03:01:23 +01:00
slack.js 🐛 Fixed emoji in Slack test notification not rendered by Discord (#9313) 2017-12-15 11:19:37 +07:00
webhooks.js Import lib/common only 2017-12-12 10:28:13 +01:00
xmlrpc.js Used request lib in xmlrpc (#9333) 2017-12-15 16:50:18 +07:00