[7.x] deprecate CONFIG_PATH and DATA_PATH (#32049) (#35405)

* deprecate CONFIG_PATH and DATA_PATH (#32049)

* rm default config from environment variable

* add deprecation logs

* fix path

* folder

* redo docs

* fix &&

* remove newline

* rm newline

* fix backport
This commit is contained in:
Jonathan Budzenski 2019-04-22 13:22:42 -05:00 committed by GitHub
parent 1dcdb7370d
commit 97b6b0e50a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 4 deletions

View file

@ -134,8 +134,7 @@ export default function (program) {
.option('-e, --elasticsearch <uri1,uri2>', 'Elasticsearch instances')
.option(
'-c, --config <path>',
'Path to the config file, can be changed with the CONFIG_PATH environment variable as well. ' +
'Use multiple --config args to include multiple config files.',
'Path to the config file, use multiple --config args to include multiple config files',
configPathCollector,
[ getConfig() ]
)

View file

@ -55,6 +55,18 @@ const loggingTimezone = (settings, log) => {
}
};
const configPath = (settings, log) => {
if (_.has(process, 'env.CONFIG_PATH')) {
log(`Environment variable CONFIG_PATH is deprecated. It has been replaced with KIBANA_PATH_CONF pointing to a config folder`);
}
};
const dataPath = (settings, log) => {
if (_.has(process, 'env.DATA_PATH')) {
log(`Environment variable "DATA_PATH" will be removed. It has been replaced with kibana.yml setting "path.data"`);
}
};
const deprecations = [
//server
unused('server.xsrf.token'),
@ -67,6 +79,8 @@ const deprecations = [
savedObjectsIndexCheckTimeout,
rewriteBasePath,
loggingTimezone,
configPath,
dataPath
];
export const transformDeprecations = createTransform(deprecations);

View file

@ -17,18 +17,20 @@
* under the License.
*/
import { join } from 'path';
import { accessSync, R_OK } from 'fs';
import { find } from 'lodash';
import { fromRoot } from '../../utils';
const CONFIG_PATHS = [
process.env.CONFIG_PATH,
process.env.KIBANA_PATH_CONF && join(process.env.KIBANA_PATH_CONF, 'kibana.yml'),
process.env.CONFIG_PATH, //deprecated
fromRoot('config/kibana.yml'),
'/etc/kibana/kibana.yml'
].filter(Boolean);
const DATA_PATHS = [
process.env.DATA_PATH,
process.env.DATA_PATH, //deprecated
fromRoot('data'),
'/var/lib/kibana'
].filter(Boolean);