-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
There are several use cases that have come up which need to be able to read the kibana.yml configuration before the core server is started or without starting the server at all:
- APM instrumentation
- To instrument dev CLIs, we need to be able to read config to initialize the APM agent without startig the server
- To initialize the APM agent in the server process itself, we need to be able to read config before the server is started
- We currently are working around this with environment variables but it has these drawbacks:
- Violates the "prefer one way to do things" principle
- Cloud does not have an easy way to configure env vars on a per-instance basis, limiting our ability to test APM instrumentation on Cloud before rolling it out more widely.
- @kbn/optimizer
- Right now the CLI only allows configuration via CLI flags, rather than via the kibana.yml file
- Causes different behavior when running via CLI and running via
yarn start(which does read from yml file and then passes into the CLI)
Proposed Solution
- Extract
src/core/configinto a new@kbn/configpackage - Move some key configuration schemas into the
@kbn/configpackage- Any configs that need to be read before the server starts will need to be present in this schema(s). For instance, APM agent configuration, optimizer configuration, path.* configuration.
- Service-specific configurations should not need to move (eg. Elasticsearch, HTTP, SavedObjects).
We may need to validate that importing this future @kbn/config package before initializing the APM agent will actually work correctly since this package itself also imports other code (Joi, for example). We may not have instrumentation on those packages, so we must make sure the impact radius of this is small enough to be acceptable.
Another caveat is that config deprecations defined by Core or plugins will not be executed when using this bare @kbn/config package. We must ensure that any config deprecations that touch the config keys we move into this package are moved into @kbn/config as well.