1.0.0 • Published 4 years ago

configurenv v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

ConfigurENV

Configuration Manager that uses Environment Variables to create your configuration.

Example

const config=require('configurenv')(
    [
        {
            type: "enum",
            values: ["MYSQL","POSTGRESQL","MSSQL"],
            env: "DRIVER",
            mapping: "driver",
            default: "MYSQL"
        },
        {
            type:"config",
            env: "CONNECTION",
            mapping: "connection",
            config: [
                {
                    type: "string",
                    env: "HOST",
                    mapping: "host",
                    default: "127.0.0.1"
                },
                {
                    type: "int",
                    env: "PORT",
                    mapping: "port",
                    default: 3300
                }
            ]
        }
    ],{
        namespace: "DEMOAPP"
    })
}).build(process.env)

console.log(config.config) //List our config values
console.log(config.struct) //List the parsed config