当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Server.injectUiAppVars方法代码示例

本文整理汇总了TypeScript中hapi.Server.injectUiAppVars方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Server.injectUiAppVars方法的具体用法?TypeScript Server.injectUiAppVars怎么用?TypeScript Server.injectUiAppVars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hapi.Server的用法示例。


在下文中一共展示了Server.injectUiAppVars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: initCodeNode

async function initCodeNode(server: Server, serverOptions: ServerOptions, log: Logger) {
  log.info('Initializing Code plugin as code-node.');
  const queueIndex: string = server.config().get('xpack.code.queueIndex');
  const queueTimeout: number = server.config().get('xpack.code.queueTimeout');
  const devMode: boolean = server.config().get('env.dev');

  const esClient: EsClient = new EsClientWithInternalRequest(server);
  const repoConfigController = new RepositoryConfigController(esClient);

  server.injectUiAppVars('code', () => ({
    enableLangserversDeveloping: devMode,
  }));
  // Enable the developing language servers in development mode.
  if (devMode === true) {
    LanguageServers.push(...LanguageServersDeveloping);
  }

  const installManager = new InstallManager(server, serverOptions);
  const lspService = new LspService(
    '127.0.0.1',
    serverOptions,
    esClient,
    installManager,
    new ServerLoggerFactory(server),
    repoConfigController
  );
  server.events.on('stop', async () => {
    await lspService.shutdown();
  });
  // Initialize indexing factories.
  const lspIndexerFactory = new LspIndexerFactory(lspService, serverOptions, esClient, log);

  const repoIndexInitializerFactory = new RepositoryIndexInitializerFactory(esClient, log);

  // Initialize queue worker cancellation service.
  const cancellationService = new CancellationSerivce();

  // Execute index version checking and try to migrate index data if necessary.
  await tryMigrateIndices(esClient, log);

  // Initialize queue.
  const queue = new Esqueue(queueIndex, {
    client: esClient,
    timeout: queueTimeout,
  });
  const indexWorker = new IndexWorker(
    queue,
    log,
    esClient,
    [lspIndexerFactory],
    serverOptions,
    cancellationService
  ).bind();

  const repoServiceFactory: RepositoryServiceFactory = new RepositoryServiceFactory();

  const cloneWorker = new CloneWorker(
    queue,
    log,
    esClient,
    serverOptions,
    indexWorker,
    repoServiceFactory
  ).bind();
  const deleteWorker = new DeleteWorker(
    queue,
    log,
    esClient,
    serverOptions,
    cancellationService,
    lspService,
    repoServiceFactory
  ).bind();
  const updateWorker = new UpdateWorker(
    queue,
    log,
    esClient,
    serverOptions,
    repoServiceFactory
  ).bind();

  // Initialize schedulers.
  const updateScheduler = new UpdateScheduler(updateWorker, serverOptions, esClient, log);
  const indexScheduler = new IndexScheduler(indexWorker, serverOptions, esClient, log);
  updateScheduler.start();
  if (!serverOptions.disableIndexScheduler) {
    indexScheduler.start();
  }
  // check code node repos on disk
  await checkRepos(cloneWorker, esClient, serverOptions, log);

  const codeServerRouter = new CodeServerRouter(server);
  // Add server routes and initialize the plugin here
  repositoryRoute(
    codeServerRouter,
    cloneWorker,
    deleteWorker,
    indexWorker,
    repoIndexInitializerFactory,
    repoConfigController,
//.........这里部分代码省略.........
开发者ID:elastic,项目名称:kibana,代码行数:101,代码来源:init.ts


注:本文中的hapi.Server.injectUiAppVars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。