Implementation of a distributed configuration using Redis, as described here.
In the project directory, you can run:
Runs the library test suite, and reports the results of each test.
Builds the library for production to the lib
folder.
It correctly bundles the library in production mode and optimizes the build for the best performance.
Lints the project files.
const Redis = require('ioredis');
const { RedConfig } = require('redconfig');
const client = new Redis();
const rconf = new RedConfig(client, 'config::global');
async function main() {
let config = await rconf.load();
// { ... }
config.level = 'info';
config = await rconf.save(config);
console.log(config);
// { level: 'info', ... }
}
import Redis = require("redis");
import { RedConfig, IRedConfig } from "redconfig";
const client = new Redis();
const rconf = new RedConfig(client, "config::global");
async function main() {
let config = await rconf.load();
// { ... }
config.level = "info";
config = await rconf.save(config);
console.log(config);
// { level: 'info', ... }
}
MIT