當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。