From 5763a2f25ae7ad5f307944c205167b55d8c94628 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Thu, 9 Sep 2021 18:31:46 -0500 Subject: [PATCH] [config] Remove deprecated environment variables `CONFIG_PATH` and `DATA_PATH` (#111535) --- docs/CHANGELOG.asciidoc | 12 +++++++ packages/kbn-utils/src/path/index.ts | 7 +--- .../deprecation/core_deprecations.test.ts | 36 ------------------- .../config/deprecation/core_deprecations.ts | 26 -------------- 4 files changed, 13 insertions(+), 68 deletions(-) diff --git a/docs/CHANGELOG.asciidoc b/docs/CHANGELOG.asciidoc index 96a7e57ef3e4f..5c409e22b9912 100644 --- a/docs/CHANGELOG.asciidoc +++ b/docs/CHANGELOG.asciidoc @@ -231,6 +231,18 @@ The `logging.useUTC` setting has been removed. For more information, refer to {k The default timezone is UTC. To change the timezone, set `logging.timezone: false` in kibana.yml. Change the timezone when the system, such as a docker container, is configured for a nonlocal timezone. ==== +[discrete] +[[breaking-32049]] +.Removed environment variables `CONFIG_PATH` and `DATA_PATH` +[%collapsible] +==== +*Details* + +The environment variables `CONFIG_PATH` and `DATA_PATH` have been removed. For more information, refer to {kibana-pull}32049[#32049] + +*Impact* + +Use the environment variable `KBN_PATH_CONF` instead of `CONFIG_PATH`. Use the setting `path.data` instead of `DATA_PATH`. +==== + // end::notable-breaking-changes[] [float] diff --git a/packages/kbn-utils/src/path/index.ts b/packages/kbn-utils/src/path/index.ts index 9d371a0c334a9..9ee699c22c30c 100644 --- a/packages/kbn-utils/src/path/index.ts +++ b/packages/kbn-utils/src/path/index.ts @@ -16,7 +16,6 @@ const isString = (v: any): v is string => typeof v === 'string'; const CONFIG_PATHS = [ process.env.KBN_PATH_CONF && join(process.env.KBN_PATH_CONF, 'kibana.yml'), process.env.KIBANA_PATH_CONF && join(process.env.KIBANA_PATH_CONF, 'kibana.yml'), // deprecated - process.env.CONFIG_PATH, // deprecated join(REPO_ROOT, 'config/kibana.yml'), '/etc/kibana/kibana.yml', ].filter(isString); @@ -28,11 +27,7 @@ const CONFIG_DIRECTORIES = [ '/etc/kibana', ].filter(isString); -const DATA_PATHS = [ - process.env.DATA_PATH, // deprecated - join(REPO_ROOT, 'data'), - '/var/lib/kibana', -].filter(isString); +const DATA_PATHS = [join(REPO_ROOT, 'data'), '/var/lib/kibana'].filter(isString); function findFile(paths: string[]) { const availablePath = paths.find((configPath) => { diff --git a/src/core/server/config/deprecation/core_deprecations.test.ts b/src/core/server/config/deprecation/core_deprecations.test.ts index a3bc9ee669903..d3a4d7f997062 100644 --- a/src/core/server/config/deprecation/core_deprecations.test.ts +++ b/src/core/server/config/deprecation/core_deprecations.test.ts @@ -18,24 +18,6 @@ describe('core deprecations', () => { process.env = { ...initialEnv }; }); - describe('configPath', () => { - it('logs a warning if CONFIG_PATH environ variable is set', () => { - process.env.CONFIG_PATH = 'somepath'; - const { messages } = applyCoreDeprecations(); - expect(messages).toMatchInlineSnapshot(` - Array [ - "Environment variable \\"CONFIG_PATH\\" is deprecated. It has been replaced with \\"KBN_PATH_CONF\\" pointing to a config folder", - ] - `); - }); - - it('does not log a warning if CONFIG_PATH environ variable is unset', () => { - delete process.env.CONFIG_PATH; - const { messages } = applyCoreDeprecations(); - expect(messages).toHaveLength(0); - }); - }); - describe('kibanaPathConf', () => { it('logs a warning if KIBANA_PATH_CONF environ variable is set', () => { process.env.KIBANA_PATH_CONF = 'somepath'; @@ -54,24 +36,6 @@ describe('core deprecations', () => { }); }); - describe('dataPath', () => { - it('logs a warning if DATA_PATH environ variable is set', () => { - process.env.DATA_PATH = 'somepath'; - const { messages } = applyCoreDeprecations(); - expect(messages).toMatchInlineSnapshot(` - Array [ - "Environment variable \\"DATA_PATH\\" will be removed. It has been replaced with kibana.yml setting \\"path.data\\"", - ] - `); - }); - - it('does not log a warning if DATA_PATH environ variable is unset', () => { - delete process.env.DATA_PATH; - const { messages } = applyCoreDeprecations(); - expect(messages).toHaveLength(0); - }); - }); - describe('xsrfDeprecation', () => { it('logs a warning if server.xsrf.whitelist is set', () => { const { migrated, messages } = applyCoreDeprecations({ diff --git a/src/core/server/config/deprecation/core_deprecations.ts b/src/core/server/config/deprecation/core_deprecations.ts index 70c987e156448..a929a937988e8 100644 --- a/src/core/server/config/deprecation/core_deprecations.ts +++ b/src/core/server/config/deprecation/core_deprecations.ts @@ -21,30 +21,6 @@ const kibanaPathConf: ConfigDeprecation = (settings, fromPath, addDeprecation) = } }; -const configPathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => { - if (process.env?.CONFIG_PATH) { - addDeprecation({ - message: `Environment variable "CONFIG_PATH" is deprecated. It has been replaced with "KBN_PATH_CONF" pointing to a config folder`, - correctiveActions: { - manualSteps: ['Use "KBN_PATH_CONF" instead of "CONFIG_PATH" to point to a config folder.'], - }, - }); - } -}; - -const dataPathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => { - if (process.env?.DATA_PATH) { - addDeprecation({ - message: `Environment variable "DATA_PATH" will be removed. It has been replaced with kibana.yml setting "path.data"`, - correctiveActions: { - manualSteps: [ - `Set 'path.data' in the config file or CLI flag with the value of the environment variable "DATA_PATH".`, - ], - }, - }); - } -}; - const rewriteBasePathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => { if (settings.server?.basePath && !settings.server?.rewriteBasePath) { addDeprecation({ @@ -404,9 +380,7 @@ export const coreDeprecationProvider: ConfigDeprecationProvider = ({ rename, unu rename('cpuacct.cgroup.path.override', 'ops.cGroupOverrides.cpuAcctPath'), rename('server.xsrf.whitelist', 'server.xsrf.allowlist'), rewriteCorsSettings, - configPathDeprecation, kibanaPathConf, - dataPathDeprecation, rewriteBasePathDeprecation, cspRulesDeprecation, opsLoggingEventDeprecation,