README
7stack.io Config
The 7stack config package is a simple configuration management package. It handles reading from a file, reading from stdin, environment variables, and command line arguments. It can also parse yaml and json.
Usage
test.js
const Config = require("@7stack.io/config");
const config = new Config(
Config.param("http-port")
.default(80)
.p("env", { key: "NODE_HTTP_PORT" })
.p("args")
.p("source", "file", { key: "http-port" }),
Config.param("remote-config")
.d({})
.p("args")
.p("https")
)
.option("envPrefix", "NODE_")
.source(
Config.param("file")
.p("env", { key: "CONFIG_FILE" })
.p("args", { key: "config-file" })
.p("file", { defaultPath: "/etc/my-program/config.yaml" })
.p("yaml")
)
.plugin("https", async (input, globalConfig, pluginConfig, name) => {
return await request.get(input);
});
console.log(await config.get());