1.0.2 • Published 8 months ago

think-ezconfig-loader v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago
/*
 * @FilePath: /playdayy-framework-template/starter.ts
 * @Descripttion:
 * @version:
 * @Author: 易华青
 * @Date: 2020-09-09 10:31:17
 * @LastEditors: huaqingyi
 * @LastEditTime: 2020-11-03 15:46:23
 * @debugger:
 */
import { join, extname } from 'path';
const { EZConfig, config } = require('ezconfig-client');
import { use } from 'think-ezconfig-loader';
const Application = require('thinkjs');

const ENV: string = process.env.ENV || 'local';

async function bootstrap() {
    await EZConfig.configuration({
        // 配置中心 APPID
        appid: 'xxx',
        // 配置中心 Secret
        secret: 'xxx',
        // 配置中心 NODE 节点 改配置为数组。
        nodes: ['xxx'],
        // 需要拉取的配置 ENV 环境
        env: 'xxx',
        // httptimeout: 3000,
        debug: true,
        // 是否订阅配更新置
        upgrage: false,
        // 订阅连接的心跳包
        // upgrageInterval: 3000,
        // 更新配置成功的回调
        // upgrageCallback: () => { },
    }).bootstrap();
    const appConfig = (await import(join(__dirname, 'bootstrap', `${ENV}${extname(__filename)}`))).default;
    const app = new Application(appConfig);
    use(app, config()).bootstrap(async () => {
        console.log('启动 TLFSON 核心配置 ...');
    });
}

bootstrap();
1.0.2

8 months ago

1.0.1

9 months ago

1.0.0

9 months ago