@adobe/aio-lib-core-config
Adobe I/O Configuration Module
Last updated 5 months ago by moritzraho .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @adobe/aio-lib-core-config 
SYNC missed versions from official npm registry.

@adobe/aio-lib-core-config

Version Downloads/week Build Status License Codecov Coverage Size(minified)

This is a nodejs module to allow management of persistent and environment variable configuration.

The module can be added to your project with:

npm install @adobe/aio-lib-core-config --save

Here is a snippet:

const config = require('@adobe/aio-lib-core-config')

// set a key value
config.set('pgb.authtoken', 1234)

// reload data from files and environmental variables
config.reload()

// get all stored data
config.get()

// get data from a given key
config.get('pgb.authtoken')

// delete a key
config.delete('pgb.authtoken')

Peristent File Locations

User Configuration

The user default location is:

  1. ENV['AIO_CONFIG_FILE']
  2. ENV['XDG_CONFIG_HOME']/aio
  3. <HOME>/.config/aio

depending on whether the specified environmental variables exist

Project Configuration

Local configuration is loaded from $PWD/.aio

Dot Env Configuration

A local .env file is also loaded. This file can contain environmental variables

Resolving Values

Resolving configuration is done in two steps:

  1. .env file is read, parsed and hoisted to environment variables ( process.env )
  2. user and local files are read

Inheritance is similar to NPMRC and can be set using user file, project file and matching environment variables. Values are read and merged in the following order in increasing priority:

  1. user config eg. ~/.config/aio
  2. project config eg. $PWD/.aio
  3. environment variables matching AIO_<PLUGIN>_<KEY>
$ AIO_PGB_AUTHTOKEN=1234 node
> config.get('pgb.authtoken')
1234

$ AIO_PGB_AUTH__TOKEN=1234 node # use double underscores to specify an underscore
> config.get('pgb.auth_token')
1234

Explore

goto API

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

Current Tags

  • 2.0.0                                ...           latest (5 months ago)

12 Versions

  • 2.0.0                                ...           5 months ago
  • 1.2.8                                ...           10 months ago
  • 1.2.7                                ...           10 months ago
  • 1.2.6                                ...           10 months ago
  • 1.2.5                                ...           10 months ago
  • 1.2.4                                ...           a year ago
  • 1.2.3                                ...           a year ago
  • 1.2.2                                ...           a year ago
  • 1.2.1                                ...           a year ago
  • 1.2.0                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.15                                ...           a year ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 37
Dependencies (5)
Dev Dependencies (13)

Copyright 2014 - 2016 © taobao.org |