confactory
Sugar-interface to create configuration factories quickly
Installation
npm install confactory --save
Example usage
// ----------------// configFactory.js// ----------------const confactory = const f = fnethost'localhost'fprodclientnethost'client-host' // alias: f.client.prod.net.host()fprodservernethost'server-host' // alias: f.server.prod.net.host() fclientnetport1337fclientprodnetport443 // alias: f.prod.client.net.port()// or in single delaration:// f.client.prod.net.port(443, 1337) fservernetport3000fprodservernetport8080 // alias: f.server.prod.net.port()// or in single declaration:// f.prod.server.net.port(8080, 3000) f f f moduleexports = f$clone
// ----------------// main.js// ----------------const f = const show = consolelog // { net: { host: 'localhost', port: 1337 },// mode: 'development',// target: 'client',// url: 'http://localhost:1337',// secret: 'foobar!' } // { net: { host: 'client-host', port: 443 },// mode: 'production',// target: 'client',// url: 'https://client-host',// secret: 'foobar!' } // { net: { host: 'localhost', port: 3000 },// mode: 'development',// target: 'server',// url: 'http://localhost:3000',// secret: 'foobar!' } // { net: { host: 'server-host', port: 8080 },// mode: 'production',// target: 'server',// url: 'http://server-host:8080',// secret: 'foobar!' }
License
MIT