mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Move server-side config service to packages (#134794)
This commit is contained in:
parent
f65685b2ac
commit
c432a22d67
22 changed files with 181 additions and 8 deletions
|
@ -158,6 +158,8 @@
|
|||
"@kbn/core-base-common-internal": "link:bazel-bin/packages/core/base/core-base-common-internal",
|
||||
"@kbn/core-base-server-internal": "link:bazel-bin/packages/core/base/core-base-server-internal",
|
||||
"@kbn/core-base-server-mocks": "link:bazel-bin/packages/core/base/core-base-server-mocks",
|
||||
"@kbn/core-config-server-internal": "link:bazel-bin/packages/core/config/core-config-server-internal",
|
||||
"@kbn/core-config-server-mocks": "link:bazel-bin/packages/core/config/core-config-server-mocks",
|
||||
"@kbn/core-doc-links-browser": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser",
|
||||
"@kbn/core-doc-links-browser-internal": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser-internal",
|
||||
"@kbn/core-doc-links-browser-mocks": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser-mocks",
|
||||
|
@ -688,6 +690,8 @@
|
|||
"@types/kbn__core-base-server-internal": "link:bazel-bin/packages/core/base/core-base-server-internal/npm_module_types",
|
||||
"@types/kbn__core-base-server-mocks": "link:bazel-bin/packages/core/base/core-base-server-mocks/npm_module_types",
|
||||
"@types/kbn__core-common-internal-base": "link:bazel-bin/packages/core/common/internal-base/npm_module_types",
|
||||
"@types/kbn__core-config-server-internal": "link:bazel-bin/packages/core/config/core-config-server-internal/npm_module_types",
|
||||
"@types/kbn__core-config-server-mocks": "link:bazel-bin/packages/core/config/core-config-server-mocks/npm_module_types",
|
||||
"@types/kbn__core-doc-links-browser": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser/npm_module_types",
|
||||
"@types/kbn__core-doc-links-browser-internal": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser-internal/npm_module_types",
|
||||
"@types/kbn__core-doc-links-browser-mocks": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser-mocks/npm_module_types",
|
||||
|
|
|
@ -26,6 +26,7 @@ filegroup(
|
|||
"//packages/core/base/core-base-common:build",
|
||||
"//packages/core/base/core-base-server-internal:build",
|
||||
"//packages/core/base/core-base-server-mocks:build",
|
||||
"//packages/core/config/core-config-server-internal:build",
|
||||
"//packages/core/doc-links/core-doc-links-browser-internal:build",
|
||||
"//packages/core/doc-links/core-doc-links-browser-mocks:build",
|
||||
"//packages/core/doc-links/core-doc-links-browser:build",
|
||||
|
@ -181,6 +182,7 @@ filegroup(
|
|||
"//packages/core/base/core-base-common:build_types",
|
||||
"//packages/core/base/core-base-server-internal:build_types",
|
||||
"//packages/core/base/core-base-server-mocks:build_types",
|
||||
"//packages/core/config/core-config-server-internal:build_types",
|
||||
"//packages/core/doc-links/core-doc-links-browser-internal:build_types",
|
||||
"//packages/core/doc-links/core-doc-links-browser-mocks:build_types",
|
||||
"//packages/core/doc-links/core-doc-links-browser:build_types",
|
||||
|
|
|
@ -8,3 +8,4 @@
|
|||
|
||||
export type { CoreContext } from './core_context';
|
||||
export type { CoreService, ServiceConfigDescriptor } from './services';
|
||||
export { CriticalError } from './errors';
|
||||
|
|
103
packages/core/config/core-config-server-internal/BUILD.bazel
Normal file
103
packages/core/config/core-config-server-internal/BUILD.bazel
Normal file
|
@ -0,0 +1,103 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_config")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
|
||||
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
|
||||
|
||||
PKG_DIRNAME = "core-config-server-internal"
|
||||
PKG_REQUIRE_NAME = "@kbn/core-config-server-internal"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
]
|
||||
|
||||
RUNTIME_DEPS = [
|
||||
"//packages/elastic-safer-lodash-set",
|
||||
"//packages/kbn-config",
|
||||
"//packages/core/base/core-base-server-internal",
|
||||
"//packages/kbn-config-mocks",
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/jest",
|
||||
"//packages/elastic-safer-lodash-set:npm_module_types",
|
||||
"//packages/kbn-config:npm_module_types",
|
||||
"//packages/kbn-config-mocks:npm_module_types",
|
||||
"//packages/core/base/core-base-server-internal:npm_module_types",
|
||||
]
|
||||
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
"//:tsconfig.bazel.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc_types",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = TYPES_DEPS,
|
||||
declaration = True,
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
root_dir = "src",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_DIRNAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = RUNTIME_DEPS + [":target_node"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [":" + PKG_DIRNAME],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [":npm_module"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm_types(
|
||||
name = "npm_module_types",
|
||||
srcs = SRCS,
|
||||
deps = [":tsc_types"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
tsconfig = ":tsconfig",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build_types",
|
||||
srcs = [":npm_module_types"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
# @kbn/core-config-server-internal
|
||||
|
||||
This package contains the internal types and implementation for Core's server-side configuration.
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test/jest_node',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/packages/core/config/core-config-server-internal'],
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "@kbn/core-config-server-internal",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target_node/index.js",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0"
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { ConfigDeprecationProvider, ConfigDeprecation } from '@kbn/config';
|
||||
import type { ConfigDeprecationProvider, ConfigDeprecation } from '@kbn/config';
|
||||
|
||||
const rewriteBasePathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => {
|
||||
if (settings.server?.basePath && !settings.server?.rewriteBasePath) {
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { configServiceMock } from '@kbn/config-mocks';
|
||||
import { ensureValidConfiguration } from './ensure_valid_configuration';
|
||||
import { CriticalError } from '../errors';
|
||||
import { CriticalError } from '@kbn/core-base-server-internal';
|
||||
|
||||
describe('ensureValidConfiguration', () => {
|
||||
let configService: ReturnType<typeof configServiceMock.create>;
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import { ConfigService, ConfigValidateParameters } from '@kbn/config';
|
||||
import { CriticalError } from '../errors';
|
||||
import { CriticalError } from '@kbn/core-base-server-internal';
|
||||
|
||||
const ignoredPaths = ['dev.', 'elastic.apm.'];
|
||||
|
|
@ -8,3 +8,4 @@
|
|||
|
||||
export { coreDeprecationProvider } from './deprecation';
|
||||
export { ensureValidConfiguration } from './ensure_valid_configuration';
|
||||
export { getDeprecationsFor, getDeprecationsForGlobalSettings } from './test_utils';
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "target_types",
|
||||
"rootDir": "src",
|
||||
"stripInternal": false,
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
import chalk from 'chalk';
|
||||
import { CliArgs, Env, RawConfigService } from '@kbn/config';
|
||||
import { CriticalError } from '@kbn/core-base-server-internal';
|
||||
import { Root } from './root';
|
||||
import { CriticalError } from './errors';
|
||||
|
||||
interface BootstrapArgs {
|
||||
configs: string[];
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
} from './elasticsearch_config.test.mocks';
|
||||
|
||||
import { ElasticsearchConfig, config } from './elasticsearch_config';
|
||||
import { getDeprecationsFor } from '../config/test_utils';
|
||||
import { getDeprecationsFor } from '@kbn/core-config-server-internal';
|
||||
|
||||
const CONFIG_PATH = 'elasticsearch';
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ jest.doMock('./ui_settings/ui_settings_service', () => ({
|
|||
}));
|
||||
|
||||
export const mockEnsureValidConfiguration = jest.fn();
|
||||
jest.doMock('./config/ensure_valid_configuration', () => ({
|
||||
jest.doMock('@kbn/core-config-server-internal', () => ({
|
||||
ensureValidConfiguration: mockEnsureValidConfiguration,
|
||||
}));
|
||||
|
||||
|
|
|
@ -17,9 +17,12 @@ import {
|
|||
ILoggingSystem,
|
||||
config as loggingConfig,
|
||||
} from '@kbn/core-logging-server-internal';
|
||||
import {
|
||||
coreDeprecationProvider,
|
||||
ensureValidConfiguration,
|
||||
} from '@kbn/core-config-server-internal';
|
||||
import { AnalyticsService } from '@kbn/core-analytics-server-internal';
|
||||
import type { AnalyticsServiceSetup } from '@kbn/core-analytics-server';
|
||||
import { coreDeprecationProvider, ensureValidConfiguration } from './config';
|
||||
import { CoreApp } from './core_app';
|
||||
import { I18nService } from './i18n';
|
||||
import { ElasticsearchService } from './elasticsearch';
|
||||
|
|
|
@ -9,4 +9,7 @@
|
|||
export { createHttpServer } from './http/test_utils';
|
||||
export { ServiceStatusLevelSnapshotSerializer } from './status/test_utils';
|
||||
export { setupServer } from './saved_objects/routes/test_utils';
|
||||
export { getDeprecationsFor, getDeprecationsForGlobalSettings } from './config/test_utils';
|
||||
export {
|
||||
getDeprecationsFor,
|
||||
getDeprecationsForGlobalSettings,
|
||||
} from '@kbn/core-config-server-internal';
|
||||
|
|
16
yarn.lock
16
yarn.lock
|
@ -3063,6 +3063,14 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-config-server-internal@link:bazel-bin/packages/core/config/core-config-server-internal":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-config-server-mocks@link:bazel-bin/packages/core/config/core-config-server-mocks":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-doc-links-browser-internal@link:bazel-bin/packages/core/doc-links/core-doc-links-browser-internal":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
@ -6478,6 +6486,14 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-config-server-internal@link:bazel-bin/packages/core/config/core-config-server-internal/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-config-server-mocks@link:bazel-bin/packages/core/config/core-config-server-mocks/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@types/kbn__core-doc-links-browser-internal@link:bazel-bin/packages/core/doc-links/core-doc-links-browser-internal/npm_module_types":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue