[Fleet] Remove enterprise license requirement for custom registry URL (#113858) (#113909)

Co-authored-by: Jen Huang <its.jenetic@gmail.com>
This commit is contained in:
Kibana Machine 2021-10-05 08:22:07 -04:00 committed by GitHub
parent 352695e656
commit ac14e64d55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 16 deletions

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { appContextService, licenseService } from '../../';
import { appContextService } from '../../';
// from https://github.com/elastic/package-registry#docker (maybe from OpenAPI one day)
// the unused variables cause a TS warning about unused values
@ -32,16 +32,9 @@ const getDefaultRegistryUrl = (): string => {
export const getRegistryUrl = (): string => {
const customUrl = appContextService.getConfig()?.registryUrl;
const isEnterprise = licenseService.isEnterprise();
if (customUrl && isEnterprise) {
return customUrl;
}
if (customUrl) {
appContextService
.getLogger()
.warn('Enterprise license is required to use a custom registry url.');
return customUrl;
}
return getDefaultRegistryUrl();

View file

@ -50,22 +50,25 @@ export async function startFleetServerSetup() {
_onResolve = resolve;
});
const logger = appContextService.getLogger();
// Check for security
if (!appContextService.hasSecurity()) {
// Fleet will not work if security is not enabled
logger?.warn('Fleet requires the security plugin to be enabled.');
return;
}
// Log information about custom registry URL
const customUrl = appContextService.getConfig()?.registryUrl;
if (customUrl) {
logger.info(
`Custom registry url is an experimental feature and is unsupported. Using custom registry at ${customUrl}`
);
}
try {
// We need licence to be initialized before using the SO service.
await licenseService.getLicenseInformation$()?.pipe(first())?.toPromise();
const customUrl = appContextService.getConfig()?.registryUrl;
const isEnterprise = licenseService.isEnterprise();
if (customUrl && isEnterprise) {
logger.info('Custom registry url is an experimental feature and is unsupported.');
}
await runFleetServerMigration();
_isFleetServerSetup = true;
} catch (err) {