1.0.0 • Published 8 years ago

thermo-properties v1.0.0

Weekly downloads
1
License
MIT
Repository
bitbucket
Last release
8 years ago

thermo-properties

A wrapper for the properties npm package. It provides a shell for importing properties into other thermo modules.

Installation

npm install --save thermo-properties

Usage

const properties = require("thermo-properties")();

properties.load("section", onload);
properties.save("section", data);
properties.flush("section");

properties file

All properties are loaded using an environment variable called properties. The variable is a pointer to the file which must be readable by the process. The content of the file needs to follow the INI syntax.

[section]
property = value
property.child = value

load("section", onload)

Loads properties from a given section and returns a promise object which, when resolved will contain all of the properties.

onload(values)

The onload parameter is used as a post-processor once properties have been read from disk but before they are returned. It returns a promise object, which when resolved will contain all of the properties for the defined section. Use this overload to perform value validation, defaulting and such things as password decryption.

save("section", data)

Saves the properties provided by data to a given section and returns a promise object, which when resolved will assert that all values are written to disk.

Tests

npm test
1.0.0

8 years ago