[config] Remove deprecated environment variables CONFIG_PATH and DATA_PATH (#111535)

This commit is contained in:
Jonathan Budzenski 2021-09-09 18:31:46 -05:00 committed by GitHub
parent 73540277e5
commit 5763a2f25a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 68 deletions

View file

@ -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]

View file

@ -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) => {

View file

@ -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({

View file

@ -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,