Loads configuration from static file and returns it as an object
This is the static file configuration loading submodule for the Toki project which is used by toki-config to load a toki configuration. See toki or toki-config for more details.
Lead Maintainer: Rob Horrigan
To get started, create a config directory at the root of your project then add
a default.js or default.json file with the following format:
'use strict';
const configuration = {
toki: {
routes: [
{
path : '/example',
httpAction : 'GET',
tags : ['api'],
description: 'Example endpoint',
actions : [
{
name: 'action 1',
type: 'http'
},
[
{
name: 'action 2',
type: 'http'
},
{
name: 'action 3',
type: 'http'
}
]
]
}
]
}
};
module.exports = configuration;OR
{
"toki": {
"routes": [
{
"path" : "/example",
"httpAction" : "GET",
"tags" : ["api"],
"description": "Example endpoint",
"actions" : [
{
"name": "action 1",
"type": "http"
},
[
{
"name": "action 2",
"type": "http"
},
{
"name": "action 3",
"type": "http"
}
]
]
}
]
}
}NOTE: If set, toki-config will use your NODE_ENV to determine which configuration to load.
$: echo $NODE_ENV
production
Will load configuration at config/production.js or config/production.json
**Obeys the import hierarchy described here
See the Toki Configuration Schema for schema specification.
Click here for an example
See API Reference
Install the dependencies based on package.json.
make install
Run tests locally.
make test