toki-config-file
v0.0.3
Published
Toki Static File Configuration Loader
Downloads
1
Readme
Toki-Config-File
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
Getting Started
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
Toki Configuration Schema
See the Toki Configuration Schema for schema specification.
Example
Click here for an example
API Reference
See API Reference
Development Setup
Install Dependencies
Install the dependencies based on package.json.
make install
Test Project
Run tests locally.
make test