Skip to content

Gathers app configuration from CLI or ENV vars and passes them to function

License

Notifications You must be signed in to change notification settings

johnvmt/node-cli-app-startup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-cli-app-startup

Gathers app configuration from CLI or ENV vars and passes them to function

Example

import startCliApp from "cli-app-startup";
import path, {dirname} from "path";
import {fileURLToPath} from "url";

const __dirname = dirname(fileURLToPath(import.meta.url));

startCliApp(
    (config) => {
        console.log("Started with config", config);
    },
    {
        cliOptions: [
            {name: "my-var", alias: "m", defaultOption: true, envvar: "my_var", default: "defaultvalue", description: "A custom CLI option or ENV var", type: String}
        ],
        packageInfo: path.join(__dirname, 'package.json')
    }
);

About

Gathers app configuration from CLI or ENV vars and passes them to function

Resources

License

Stars

Watchers

Forks

Packages

No packages published