1.0.0 • Published 5 years ago

@7stack.io/config v1.0.0

Weekly downloads
-
License
WTFPL
Repository
gitlab
Last release
5 years ago

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());
1.0.0

5 years ago

0.1.0

5 years ago

1.0.0-alpha.6

5 years ago

1.0.0-alpha.5

5 years ago

1.0.0-alpha.4

5 years ago

1.0.0-alpha.3

5 years ago

1.0.0-alpha.2

5 years ago

1.0.0-alpha.1

5 years ago

1.0.0-alpha

5 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago