Socket
Book a DemoInstallSign in
Socket

tangle-config

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tangle-config

Configuration manager for tangle

latest
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

tangle-config

Configuration management for tangle

Strider Build Status Travis Build Status Dependency Status devDependency Status Gittip

NPM

Overview

tangle is a set of tools for building web applications.

tangle-config implements the config subcommand for tangle.

Usage

--key, -k [String] - A configuration key to operate on. If --value is not
                     set, the current value will be written to STDOUT. Keys
                     are namespaced and delimited by ':'.

--value, -v [String] - Save a new value to the specified key.

--file, -f [Path] - Explicitely specify the configFile to operate on. If
                    not set, $HOME/.tangle will be used.

--edit, -e - Manually edit configuration with $EDITOR

--help, -h - Display this message

Examples

# Set your Github username
$ tangle-config -k github:username -v 'yourname'

# Print the current Github username to STDOUT
$ tangle-config -k github:username

# Edit configuration using a text editor
$ tangle-config --edit

API

You can (and should!) use this interface to manage user configuration within your own tangle plugins.


config = require 'tangle-config'

# Reading the global defaults
config.defaults

# Getting the current config file path
config.configFile()

# Retrieving the nconf object
nconf = config.getConf()

# Getting a value
nconf.get 'namespace:key'

The nconf object returned using configFile() has already loaded the config file, env overrides, and the global defaults (in that order of precedence).

The default config file is ~/.tangle, which can be changed by setting the environment variable tangle_config=PATH

See nconf for further documentation.

Project Files

You can use project files to store non-global configuration in a file called tangle.json at the current directory.

config = require 'tangle-config'

# Get a `tangle.json` file in the current working directory
projectFile = config.projectFile()

# Retrieving the nconf object
project = config.getProject()

# Getting a value
project.get 'namespace:key'

# Setting a value
project.set 'namespace:key', value

# Saving the file
project.save (err) ->
  fs.readFile projectFile, (err, data) -> console.error err if err

Contributing

The test suite is implemented with nodeunit and nixt.

To rebuild & run the tests

$ mkdir tanglejs
$ cd tanglejs
$ git clone https://github.com/tanglejs/config.git
$ cd config
$ npm install
$ grunt test

You can use grunt watch to automatically rebuild and run the test suite when files are changed.

Use npm link from the project directory to tell tangle-config to use your modified tangle-config during development.

To contribute back, fork the repo and open a pull request with your changes.

License

Copyright (c) 2014 Logan Koester Licensed under the MIT license.

Keywords

tangle

FAQs

Package last updated on 04 Feb 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts