mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[Config Service] Expose serverless
contextRef (#156837)
This commit is contained in:
parent
1506cb2aef
commit
ff6943376d
8 changed files with 207 additions and 9 deletions
|
@ -147,3 +147,64 @@ export const config: PluginConfigDescriptor<ConfigType> = {
|
|||
],
|
||||
};
|
||||
----
|
||||
[[validating-your-configuration-based-on-context-references]]
|
||||
=== Validating your configuration based on context references
|
||||
Some features require special configuration when running in different modes (dev/prod/dist, or even serverless). For purpose, core injects the following _references_ in the validation's context:
|
||||
|
||||
[cols="^1,^1,3"]
|
||||
|===
|
||||
|Context Reference |Potential values |Description
|
||||
|
||||
|`dev`
|
||||
|`true`\|`false`
|
||||
|Is Kibana running in Dev mode?
|
||||
|
||||
|`prod`
|
||||
|`true`\|`false`
|
||||
|Is Kibana running in Production mode (running from binary)?
|
||||
|
||||
|`dist`
|
||||
|`true`\|`false`
|
||||
|Is Kibana running from a distributable build (not running from source)?
|
||||
|
||||
|`serverless`
|
||||
|`true`\|`false`
|
||||
|Is Kibana running in Serverless offering?
|
||||
|
||||
|`version`
|
||||
|`8.9.0`
|
||||
|The current version of Kibana
|
||||
|
||||
|`buildNum`
|
||||
|`12345`
|
||||
|The build number
|
||||
|
||||
|`branch`
|
||||
|`main`
|
||||
|The current branch running
|
||||
|
||||
|`buildSha`
|
||||
|`12345`
|
||||
|The build SHA (typically refers to the last commit's SHA)
|
||||
|
||||
|===
|
||||
|
||||
To use any of the references listed above in a config validation schema, they can be accessed via `schema.contextRef('{CONTEXT_REFERENCE}')`:
|
||||
|
||||
[source,js]
|
||||
----
|
||||
export const config = {
|
||||
schema: schema.object({
|
||||
// Enabled by default in Dev mode
|
||||
enabled: schema.boolean({ defaultValue: schema.contextRef('dev') }),
|
||||
|
||||
// Setting only allowed in the Serverless offering
|
||||
plansForWorldPeace: schema.conditional(
|
||||
schema.contextRef('serverless'),
|
||||
true,
|
||||
schema.string({ defaultValue: 'Free hugs' }),
|
||||
schema.never()
|
||||
),
|
||||
}),
|
||||
};
|
||||
----
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue