2.0.3 • Published 2 years ago

virtual-config v2.0.3

Weekly downloads
2
License
MIT
Repository
-
Last release
2 years ago

virtual-config

Config solution for multi environment applications, written in typescript.

Install

npm install --save virtual-config

Usage

import { ConfigCreator } from "virtual-config";

let inputConfig = {
	"dev.server": "localhost:3000",
	"prod.server": "production.com",
	"test.server": "testing.com",

	timeout: 5000,
	"dev.timeout": 9000,

	someObject: {
		hello: "default world",
		"prod.hello": "production world"
	},

	someArray: [
		{
			monstersAndMen: "good music",
			"prod.status": "live",
			"dev.status": "17/1/2015"
		},
		{
			theLonelyIsland: "funny music",
			"prod.status": "live",
			"dev.status": "10/10/2014"
		}
	]
};

let creator = new ConfigCreator();
let configDev = creator.createByPrefix({ prefix: "dev", inputConfig: inputConfig });
let configProd = creator.createByPrefix({ prefix: "prod", inputConfig: inputConfig });

Dev config value:

{
	server: 'localhost:3000',
	timeout: 9000,
	someObject: { hello: 'default world' },
	someArray: [
		{ monstersAndMen: 'good music', status: '17/1/2015' },
		{ theLonelyIsland: 'funny music', status: '10/10/2014' }
	]
}

Prod config value:

{
	server: 'production.com',
	timeout: 5000,
	someObject: { hello: 'production world' },
	someArray: [
		{ monstersAndMen: 'good music', status: 'live' },
		{ theLonelyIsland: 'funny music', status: 'live' }
	]
}
2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago