# toki-config-file

> Toki Static File Configuration Loader

Latest version **0.0.3** (published 2017-02-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install toki-config-file
pnpm add toki-config-file
yarn add toki-config-file
bun add toki-config-file
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2017-02-13 |
| First published | 2017-02-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.x.x |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | XO Group, Inc. |
| Maintainers | xogrp |
| Keywords | toki-config-file |

## Links

- npm: https://www.npmjs.com/package/toki-config-file
- Repository: https://github.com/xogroup/toki-config-file
- Homepage: https://github.com/xogroup/tok-config-file#readme
- Issues: https://github.com/xogroup/toki-config-file/issues
- npm.io page: https://npm.io/package/toki-config-file

## Dependencies (2)

- [bluebird](https://npm.io/package/bluebird.md) ^3.4.7
- [ez-config](https://npm.io/package/ez-config.md) ^0.2.1

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2017-02-13
- 0.0.2 — 2017-02-13
- 0.0.1 — 2017-02-13

## README

# Toki-Config-File <!-- Repo Name -->
> Loads configuration from static file and returns it as an object <!-- Repo Brief Description -->

<!-- Long Description -->
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](https://github.com/xogroup/toki) or [toki-config](https://github.com/xogroup/toki-config) for more details.

<!-- Maintainer (Hint, probably you) -->
Lead Maintainer: [Rob Horrigan](https://github.com/robhorrigan)

<!-- Badges Go Here -->

<!-- Build Status from Travis --><!-- Security Scan from Snyk.io --><!-- Security Scan from NSP -->
[![npm version](https://badge.fury.io/js/toki-config-file.svg)](https://badge.fury.io/js/toki-config-file)
[![Build Status](https://travis-ci.org/xogroup/toki-config-file.svg?branch=master)](https://travis-ci.org/xogroup/toki-config-file)
[![Known Vulnerabilities](https://snyk.io/test/github/xogroup/toki-config-file/badge.svg)](https://snyk.io/test/github/xogroup/toki-config-file)
[![NSP Status](https://nodesecurity.io/orgs/xo-group/projects/f49cc4e1-50db-40b1-9d18-b7a84b7f41eb/badge)](https://nodesecurity.io/orgs/xo-group/projects/f49cc4e1-50db-40b1-9d18-b7a84b7f41eb)

<!-- End Badges -->
<!-- Quick Example -->
## 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:

```Javascript
'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
```Javascript
{
    "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](https://github.com/lorenwest/node-config/wiki/Configuration-Files)

***

### Toki Configuration Schema

See the [Toki Configuration Schema](https://github.com/xogroup/toki-config/blob/master/schema.md) for schema specification.

### Example
[Click here](https://github.com/xogroup/toki-config-file/blob/master/example.md) for an example

### API Reference
See [API Reference](https://github.com/xogroup/toki-config-file/blob/master/API.md)

## Development Setup

### Install Dependencies
Install the dependencies based on package.json.
```Text
make install
```

### Test Project
Run tests locally.
```Text
make test
```

<!-- Customize this if needed -->
<!-- Anything Else (Sponsors, Links, Etc) -->

---
_Source: https://npm.io/package/toki-config-file · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
