Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: load config once and support load singleton service before framework start #970

Merged
merged 3 commits into from
Apr 5, 2021

Conversation

czy88840616
Copy link
Member

@czy88840616 czy88840616 commented Apr 5, 2021

fix: #969
close: #958

示例如下:

Bootstrap
  .load(globalConfig => {
    // 加载主 web 框架
    const framework = new WebFramemwork();
    framework.configure(globalConfig.cluster);
    return framework;
  })
  .load(globalConfig => {
    // 加载副 socket.io 框架
    const framework = new SocketFramemwork();
    framework.configure();
    return framework;
  })
  .before(async (container) => {
    const configService = await container.getAsync('remoteConfigService');
    const data = await configService.getRemoteConfig();
    container.getConfigService().addObject(data);
  })
  .run();

@gitpod-io
Copy link

gitpod-io bot commented Apr 5, 2021

@czy88840616 czy88840616 changed the title feat: support load remote config in before method fix: load config once and support load singleton service before framework start Apr 5, 2021
@czy88840616 czy88840616 merged commit 201dd59 into 2.x Apr 5, 2021
@czy88840616 czy88840616 deleted the add_async_load_config branch April 5, 2021 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant