-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Move core config service to kbn/config
package
#76874
Changes from 3 commits
29d8dfc
8269fa0
aa32943
7d79ca2
545c867
92243ba
c965735
c016d45
601173c
1086b29
67d6575
f825d42
b2dbebe
3c1fac0
e1152a1
ba6b703
0bb5c5d
b0c9209
d9069c3
d1fe014
7999389
29e8ae6
4d874ef
fb4bc59
8828c18
9997809
fe0fcc5
c80dd02
c0abb98
b77c901
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# `@kbn/config` — Kibana configuration file loader | ||
|
||
`@kbn/config-schema` is a TypeScript library inspired by Joi and designed to allow run-time validation of the | ||
Kibana configuration entries providing developers with a fully typed model of the validated data. | ||
|
||
## Table of Contents | ||
|
||
- [Why `@kbn/config-schema`?](#why-kbnconfig-schema) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "@kbn/config", | ||
"main": "./target/out/index.js", | ||
pgayvallet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"types": "./target/types/index.d.ts", | ||
"version": "1.0.0", | ||
"license": "Apache-2.0", | ||
"private": true, | ||
"scripts": { | ||
"build": "tsc", | ||
"kbn:bootstrap": "yarn build" | ||
}, | ||
"dependencies": { | ||
"@kbn/config-schema": "1.0.0", | ||
"@kbn/dev-utils": "1.0.0", | ||
"rxjs": "^6.5.5", | ||
"js-yaml": "3.13.1" | ||
}, | ||
"devDependencies": { | ||
"typescript": "4.0.2", | ||
"tsd": "^0.7.4" | ||
}, | ||
"peerDependencies": { | ||
"lodash": "^4.17.15", | ||
"@elastic/safer-lodash-set": "0.0.0", | ||
"moment": "^2.24.0", | ||
"type-detect": "^4.0.8" | ||
} | ||
pgayvallet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
export { | ||
ConfigDeprecation, | ||
ConfigDeprecationWithContext, | ||
ConfigDeprecationLogger, | ||
ConfigDeprecationFactory, | ||
ConfigDeprecationProvider, | ||
} from './types'; | ||
export { configDeprecationFactory } from './deprecation_factory'; | ||
export { applyDeprecations } from './apply_deprecations'; |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -22,7 +22,7 @@ import { PackageInfo, EnvironmentMode } from './types'; | |||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
// `require` is necessary for this to work inside x-pack code as well | ||||||||||||||||||||||||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||||||||||||||||||||||||||||
const pkg = require('../../../../package.json'); | ||||||||||||||||||||||||||||
const pkg = require('../../../package.json'); | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that this is in a package, these hardcoded requires won't work anymore, as the compiled file in Note that as The mocking (see EDIT: done. Fun fact, tests that are mocking the kibana/packages/kbn-dev-utils/src/repo_root.ts Lines 47 to 59 in 7b4278d
It's quite bad because it's not only impacting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented on this here: #76874 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #76518 is almost ready for review including resolving the tests mocking fs by being explicit about the actual files they wish to mock - |
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
/** @internal */ | ||||||||||||||||||||||||||||
export interface EnvOptions { | ||||||||||||||||||||||||||||
|
@@ -55,7 +55,7 @@ export class Env { | |||||||||||||||||||||||||||
* @internal | ||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||
public static createDefault(options: EnvOptions): Env { | ||||||||||||||||||||||||||||
const repoRoot = dirname(require.resolve('../../../../package.json')); | ||||||||||||||||||||||||||||
const repoRoot = dirname(require.resolve('../../../package.json')); | ||||||||||||||||||||||||||||
return new Env(repoRoot, options); | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
export { | ||
applyDeprecations, | ||
ConfigDeprecation, | ||
ConfigDeprecationFactory, | ||
configDeprecationFactory, | ||
ConfigDeprecationLogger, | ||
ConfigDeprecationProvider, | ||
ConfigDeprecationWithContext, | ||
} from './deprecation'; | ||
|
||
export { RawConfigurationProvider, RawConfigService } from './raw'; | ||
|
||
export { ConfigService, IConfigService } from './config_service'; | ||
export { Config, ConfigPath, isConfigPath, hasConfigPathIntersection } from './config'; | ||
export { ObjectToConfigAdapter } from './object_to_config_adapter'; | ||
export { CliArgs, Env } from './env'; | ||
export { EnvironmentMode, PackageInfo } from './types'; | ||
export { LegacyObjectToConfigAdapter } from './legacy'; | ||
|
||
// mocks | ||
export { configMock } from './config.mock'; | ||
export { configServiceMock } from './config_service.mock'; | ||
export { rawConfigServiceMock } from './raw/raw_config_service.mock'; | ||
export { getEnvOptions } from './__mocks__/env'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As these mocks are used in I couldn't find a way to have something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our nodejs version doesn't support There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we build in place and can't produce the JS at the root of the module, I don't see any other alternative. Sounds like the best thing right now would be to use target in the import until we upgrade to v12. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
export { LegacyObjectToConfigAdapter } from './legacy_object_to_config_adapter'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to add proper readme once this is finished.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reference to
@kbn/config-schema
is rather confusing. Isn't it? Let's remove it