1.3.2 • Published 8 years ago

conf-store v1.3.2

Weekly downloads
169
License
MIT
Repository
github
Last release
8 years ago

Filterable config store, based on Hapijs Confidence

Dependency Status Build Status Coverage Status

why?

I wanted a lightweight alternative to Hapijs Confidence library. I was using it in a client side project, and found it a bit heavy.

example

import ConfStore from 'conf-store'

const config = {
  apiKey: {
    "$filter": "env",
    "development": "asdfasdf",
    "staging": "asfasdf",
    "production": "asfdasd"
  }
}
const store = new Store(config)
const manifest = store.get('/', { env: process.env.NODE_ENV })
export default manifest
//manifest is an object filtered by NODE_ENV in this example

CLI

A cli is also available in order to export a filtered store to a json file to use in a client side app for example consumed by webpack.

in pakage.json scripts block:

build-config: confStore fixtures/store.js -p '/' -f env=$NODE_ENV -o dist/config.json

the first arugment is the path to the module that exports the unfiltered store.

import ConfStore from 'conf-store'

const config = {
  apiKey: {
    "$filter": "env",
    "development": "asdfasdf",
    "staging": "asfasdf",
    "production": "asfdasd"
  }
}
const store = new Store(config)

export default store

-p arg is the path you want to get from the store to export.

-f is the filter you want to apply. it will be converted to

{ env: 'development'}

to be applied against the store

-o is where the file should be output.

1.3.2

8 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.0

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago