mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Add deprecation warning if setting server.host to "0" (#87471)
This commit is contained in:
parent
00bf2363bc
commit
00c3b18b93
2 changed files with 31 additions and 0 deletions
|
@ -120,6 +120,26 @@ describe('core deprecations', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('server.host', () => {
|
||||
it('logs a warning if server.host is set to "0"', () => {
|
||||
const { messages } = applyCoreDeprecations({
|
||||
server: { host: '0' },
|
||||
});
|
||||
expect(messages).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"Support for setting server.host to \\"0\\" in kibana.yml is deprecated and will be removed in Kibana version 8.0.0. Instead use \\"0.0.0.0\\" to bind to all interfaces.",
|
||||
]
|
||||
`);
|
||||
});
|
||||
it('does not log a warning if server.host is not set to "0"', () => {
|
||||
const { migrated, messages } = applyCoreDeprecations({
|
||||
server: { host: '0.0.0.0' },
|
||||
});
|
||||
expect(migrated.server.host).toEqual('0.0.0.0');
|
||||
expect(messages.length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('rewriteBasePath', () => {
|
||||
it('logs a warning is server.basePath is set and server.rewriteBasePath is not', () => {
|
||||
const { messages } = applyCoreDeprecations({
|
||||
|
|
|
@ -114,6 +114,16 @@ const mapManifestServiceUrlDeprecation: ConfigDeprecation = (settings, fromPath,
|
|||
return settings;
|
||||
};
|
||||
|
||||
const serverHostZeroDeprecation: ConfigDeprecation = (settings, fromPath, log) => {
|
||||
if (get(settings, 'server.host') === '0') {
|
||||
log(
|
||||
'Support for setting server.host to "0" in kibana.yml is deprecated and will be removed in Kibana version 8.0.0. ' +
|
||||
'Instead use "0.0.0.0" to bind to all interfaces.'
|
||||
);
|
||||
}
|
||||
return settings;
|
||||
};
|
||||
|
||||
export const coreDeprecationProvider: ConfigDeprecationProvider = ({
|
||||
unusedFromRoot,
|
||||
renameFromRoot,
|
||||
|
@ -159,4 +169,5 @@ export const coreDeprecationProvider: ConfigDeprecationProvider = ({
|
|||
rewriteBasePathDeprecation,
|
||||
cspRulesDeprecation,
|
||||
mapManifestServiceUrlDeprecation,
|
||||
serverHostZeroDeprecation,
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue