Skip to content
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

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

Merged
merged 3 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
7 changes: 1 addition & 6 deletions packages/kbn-utils/src/path/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) => {
Expand Down
36 changes: 0 additions & 36 deletions src/core/server/config/deprecation/core_deprecations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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({
Expand Down
26 changes: 0 additions & 26 deletions src/core/server/config/deprecation/core_deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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,
Expand Down