@tosee/config
TypeScript icon, indicating that this package has built-in type declarations

1.1.8 • Public • Published

codecov NPM version CI

介绍

配置文件加载,根据NODE_ENV环境变量在配置的CONFIG环境变量路径中查找对应的ts或js文件,加载的值可以通过@Value装饰器注入

快速开始

export CONFIG=./src/config
export NODE_ENV=test

src/config/default.ts

export default {
    test1: false,
    test3: 1 + 2
};

src/config/test.ts

export default {
	test1: true,
	test2: 1 + 2
};
import { Config } from '@tosee/config'
class TestSuit {
    @Value("test1")
    test1: Boolean;

    test(){
        console.log(Config.instance.test1);
        console.log(Config.instance.test2);
        console.log(Config.instance.test3);
        console.log(this.test1);
    }
}
new TestSuit().test();
true
3
3
true

Readme

Keywords

none

Package Sidebar

Install

npm i @tosee/config

Weekly Downloads

19

Version

1.1.8

License

MIT

Unpacked Size

27.6 kB

Total Files

30

Last publish

Collaborators

  • tosee