Fix Rest Util if empty of null om url

This commit is contained in:
mohitdeuex 2025-05-12 10:18:01 +05:30
parent 1640cf088a
commit f06fc3b37e
3 changed files with 10 additions and 6 deletions

View File

@ -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) {

View File

@ -23,7 +23,8 @@
},
"openMetadataUrl": {
"description": "Openmetadata Server Endpoint",
"type": "string"
"type": "string",
"default": "http://localhost:8585"
},
"senderMail": {
"description": "Mail of the sender",

View File

@ -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 {