0.4.0 • Published 2 months ago

@seneca/config v0.4.0

Weekly downloads
36
License
MIT
Repository
github
Last release
2 months ago

@seneca/config

Seneca Config is a plugin for Seneca

Live configuration plugin for the Seneca framework.

Unlike static configuration, this plugin lets you store keyed configuration in your deployed persistent storage so that you can change it on the live system. This is useful for things like currency exchange rates, feature flags, A/B testing etc.

npm version build Coverage Status Known Vulnerabilities DeepScan grade Maintainability

VoxgigThis open source module is sponsored and supported by Voxgig.

Install

$ npm install @seneca/Config

Quick Example

seneca.use('Config', {})

const initRes = await seneca.post('sys:config,init:val,key:a,val:1')
// === { ok: true, key: 'a', val: 1, entry: { key: 'a', val: 1 } }

const getRes = await seneca.post('sys:config,get:val,key:a')
// === { ok: true, key: 'a', val: 1, entry: { key: 'a', val: 1 } }

const setRes = await seneca.post('sys:config,set:val,key:a,val:2')
// === { ok: true, key: 'a', val: 1, entry: { key: 'a', val: 2 } }

More Examples

Review the unit tests for more examples.

Options

  • debug : boolean
  • numparts : number
  • canon : object
  • init$ : boolean

Action Patterns

Action Descriptions

« sys:config,get:val »

Get a config value by key.

Parameters

  • key : string

« sys:config,init:val »

Initialise a config value by key (must not exist).

Parameters

  • key : string
  • existing : boolean (optional, default: false)

« sys:config,list:val »

List config values by query.

Parameters

  • q : object (optional, default: {})

« sys:config,map:val »

Get a map of config values by key prefix (dot separated).

Parameters

  • prefix : string

« sys:config,set:val »

Set a config value by key (must exist).

Parameters

  • key : string

Motivation

Support

API

Contributing

Background

0.4.0

2 months ago

0.3.0

2 months ago

0.2.0

3 years ago

0.1.0

3 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago