Fix Slack Config to be read from UI (#24396)

* Fix Slack Config

* Update generated TypeScript types

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Mohit Yadav 2025-11-18 11:11:16 +05:30 committed by GitHub
parent 3a9918d23d
commit 421df519a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 83 additions and 26969 deletions

View File

@ -202,6 +202,8 @@ public class OpenMetadataApplication extends Application<OpenMetadataApplication
this.environment = environment;
OpenMetadataApplicationConfigHolder.initialize(catalogConfig);
validateConfiguration(catalogConfig);
// Instantiate incident severity classifier

View File

@ -0,0 +1,52 @@
/*
* Copyright 2021 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
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openmetadata.service;
import java.util.Objects;
public final class OpenMetadataApplicationConfigHolder {
private static volatile OpenMetadataApplicationConfig instance;
private OpenMetadataApplicationConfigHolder() {
throw new UnsupportedOperationException("Utility class cannot be instantiated");
}
public static void initialize(OpenMetadataApplicationConfig config) {
Objects.requireNonNull(config, "OpenMetadataApplicationConfig cannot be null");
if (instance != null) {
throw new IllegalStateException("OpenMetadataApplicationConfig has already been initialized");
}
synchronized (OpenMetadataApplicationConfigHolder.class) {
if (instance != null) {
throw new IllegalStateException(
"OpenMetadataApplicationConfig has already been initialized");
}
instance = config;
}
}
public static OpenMetadataApplicationConfig getInstance() {
OpenMetadataApplicationConfig result = instance;
if (result == null) {
throw new IllegalStateException(
"OpenMetadataApplicationConfig has not been initialized. Call initialize() first.");
}
return result;
}
public static boolean isInitialized() {
return instance != null;
}
}

View File

@ -17,6 +17,18 @@
"signingSecret": {
"description": "Signing Secret of the Application. Confirm that each request comes from Slack by verifying its unique signature.",
"type": "string"
},
"userToken": {
"title": "User Token",
"description": "User Token",
"type": "string",
"format": "password"
},
"botToken": {
"title": "Bot Token",
"description": "Bot Token",
"type": "string",
"format": "password"
}
},
"required": ["clientId", "clientSecret","signingSecret"],

View File

@ -1,27 +0,0 @@
{
"$id": "https://open-metadata.org/schema/entity/applications/configuration/slackAppTokenConfiguration.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "SlackAppTokenConfiguration",
"description": "This schema defines the Slack App Token Configuration",
"type": "object",
"javaType": "org.openmetadata.schema.entity.applications.configuration.SlackAppTokenConfiguration",
"properties": {
"userToken": {
"title": "User Token",
"description": "User Token",
"type": "string",
"format": "password"
},
"botToken": {
"title": "Bot Token",
"description": "Bot Token",
"type": "string",
"format": "password"
}
},
"additionalProperties": false,
"required": [
"userToken",
"botToken"
]
}

View File

@ -14,6 +14,10 @@
* This schema defines the Slack App Information
*/
export interface SlackAppConfiguration {
/**
* Bot Token
*/
botToken?: string;
/**
* Client Id of the Application
*/
@ -27,4 +31,8 @@ export interface SlackAppConfiguration {
* verifying its unique signature.
*/
signingSecret: string;
/**
* User Token
*/
userToken?: string;
}

View File

@ -1,25 +0,0 @@
/*
* 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
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This schema defines the Slack App Token Configuration
*/
export interface SlackAppTokenConfiguration {
/**
* Bot Token
*/
botToken: string;
/**
* User Token
*/
userToken: string;
}

View File

@ -397,6 +397,10 @@ export interface PipelineServiceClientConfiguration {
* OpenMetadata Server Endpoint
*/
openMetadataUrl?: string;
/**
* Bot Token
*/
botToken?: string;
/**
* Client Secret of the Application.
*/
@ -405,7 +409,11 @@ export interface PipelineServiceClientConfiguration {
* Signing Secret of the Application. Confirm that each request comes from Slack by
* verifying its unique signature.
*/
signingSecret?: string;
signingSecret?: string;
/**
* User Token
*/
userToken?: string;
metricConfiguration?: MetricConfigurationDefinition[];
/**
* Configurations of allowed searchable fields for each entity type