diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/RestUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/RestUtil.java index f3969a702d9..d1e2832affa 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/RestUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/RestUtil.java @@ -13,6 +13,7 @@ package org.openmetadata.service.util; +import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty; import static org.openmetadata.schema.type.EventType.ENTITY_CREATED; import static org.openmetadata.schema.type.EventType.ENTITY_NO_CHANGE; import static org.openmetadata.schema.type.EventType.ENTITY_RESTORED; @@ -74,7 +75,11 @@ public final class RestUtil { SettingsType.EMAIL_CONFIGURATION, new SmtpSettings().withOpenMetadataUrl(uriInfo.getBaseUri().toString()), SmtpSettings.class); - return URI.create(smtpSettings.getOpenMetadataUrl() + "/" + collectionPath); + String url = + nullOrEmpty(smtpSettings.getOpenMetadataUrl()) + ? uriInfo.getBaseUri().toString() + : smtpSettings.getOpenMetadataUrl(); + return URI.create(url + "/" + collectionPath); } public static URI getHref(URI parent, String child) { diff --git a/openmetadata-spec/src/main/resources/json/schema/email/smtpSettings.json b/openmetadata-spec/src/main/resources/json/schema/email/smtpSettings.json index 96502708aa0..7a47140bfd6 100644 --- a/openmetadata-spec/src/main/resources/json/schema/email/smtpSettings.json +++ b/openmetadata-spec/src/main/resources/json/schema/email/smtpSettings.json @@ -23,7 +23,8 @@ }, "openMetadataUrl": { "description": "Openmetadata Server Endpoint", - "type": "string" + "type": "string", + "default": "http://localhost:8585" }, "senderMail": { "description": "Mail of the sender", diff --git a/openmetadata-ui/src/main/resources/ui/src/generated/email/smtpSettings.ts b/openmetadata-ui/src/main/resources/ui/src/generated/email/smtpSettings.ts index 6a78e223848..2da44f93b18 100644 --- a/openmetadata-ui/src/main/resources/ui/src/generated/email/smtpSettings.ts +++ b/openmetadata-ui/src/main/resources/ui/src/generated/email/smtpSettings.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 Collate. + * Copyright 2025 Collate. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -10,9 +10,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - - /** +/** * This schema defines the SMTP Settings for sending Email */ export interface SMTPSettings {