Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/buttercup/config
Configuration utility
https://github.com/buttercup/config
buttercup configuration configure settings
Last synced: 28 days ago
JSON representation
Configuration utility
- Host: GitHub
- URL: https://github.com/buttercup/config
- Owner: buttercup
- License: mit
- Created: 2017-11-02T19:58:32.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-23T22:08:59.000Z (over 6 years ago)
- Last Synced: 2024-10-30T00:55:00.847Z (3 months ago)
- Topics: buttercup, configuration, configure, settings
- Language: JavaScript
- Size: 155 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Config
Configuration utility[![npm version](https://badge.fury.io/js/%40buttercup%2Fconfig.svg)](https://badge.fury.io/js/%40buttercup%2Fconfig) [![Build Status](https://travis-ci.org/buttercup/config.svg?branch=master)](https://travis-ci.org/buttercup/config)
## About
This library provides tools for configuring Buttercup entities and applications. Buttercup Archives, Groups and Entries can be configured easily, as well as raw objects for general application support (settings pages etc.).## Installation
Run `npm install @buttercup/config --save` to install and save the library.## Usage
Configuring Buttercup entities is easy:```javascript
const { Archive } = require("buttercup");
const { configureButtercup } = require("@buttercup/config");const archive = Archive.createWithDefaults();
const config = configureButtercup(archive);
config.set("test.value", 123);
config.apply();
```Use the `configureButtercup(entity)` method to configure instances, and use the `config#apply()` method to apply the configuration (write it to the instance). Buttercup configurations are stored using attribute values.
Objects are written in a nested manner, whilst arrays are written directly. This means that objects can be composed and merged (especially during merge conflicts), but arrays are overwritten (including nested objects). It is therefore advised to keep configurations simple: Use nestedness sparingly and expect that arrays will never be merged.