-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e56e893
commit f9f661e
Showing
17 changed files
with
1,484 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
174 changes: 174 additions & 0 deletions
174
sermant-backend/src/main/java/com/huaweicloud/sermant/backend/common/conf/BackendConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* 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 com.huaweicloud.sermant.backend.common.conf; | ||
|
||
import com.huaweicloud.sermant.backend.dao.DatabaseType; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Locale; | ||
|
||
/** | ||
* 事件配置 | ||
* | ||
* @author xuezechao | ||
* @since 2023-03-02 | ||
*/ | ||
@Component | ||
@Configuration | ||
public class BackendConfig { | ||
|
||
/** | ||
* 数据库类型 | ||
*/ | ||
@Value("${database.type}") | ||
private String database; | ||
|
||
/** | ||
* 数据库地址 | ||
*/ | ||
@Value("${database.address}") | ||
private String url; | ||
|
||
@Value("${database.user}") | ||
private String user; | ||
|
||
@Value("${database.password}") | ||
private String password; | ||
|
||
@Value("${database.expire}") | ||
private String expire; | ||
|
||
@Value("${webhook.eventpush.level}") | ||
private String webhookPushEventThreshold; | ||
|
||
@Value("${database.version}") | ||
private String version; | ||
|
||
@Value("${database.max.total}") | ||
private String maxTotal; | ||
|
||
@Value("${database.max.idle}") | ||
private String maxIdle; | ||
|
||
@Value("${database.timeout}") | ||
private String timeout; | ||
|
||
@Value("${session.expire}") | ||
private String sessionTimeout; | ||
|
||
@Value("${database.filter.thread.num}") | ||
private String filterThreadNum; | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
public void setUrl(String url) { | ||
this.url = url; | ||
} | ||
|
||
public DatabaseType getDatabase() { | ||
return DatabaseType.valueOf(database.toUpperCase(Locale.ROOT)); | ||
} | ||
|
||
public void setDatabase(String db) { | ||
this.database = db; | ||
} | ||
|
||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public String getExpire() { | ||
return expire; | ||
} | ||
|
||
public void setExpire(String expire) { | ||
this.expire = expire; | ||
} | ||
|
||
public void setWebhookPushEventThreshold(String webhookPushEventThreshold) { | ||
this.webhookPushEventThreshold = webhookPushEventThreshold; | ||
} | ||
|
||
public String getWebhookPushEventThreshold() { | ||
return webhookPushEventThreshold; | ||
} | ||
|
||
public String getUser() { | ||
return user; | ||
} | ||
|
||
public void setUser(String user) { | ||
this.user = user; | ||
} | ||
|
||
public String getVersion() { | ||
return version; | ||
} | ||
|
||
public void setVersion(String version) { | ||
this.version = version; | ||
} | ||
|
||
public String getMaxIdle() { | ||
return maxIdle; | ||
} | ||
|
||
public void setMaxIdle(String maxIdle) { | ||
this.maxIdle = maxIdle; | ||
} | ||
|
||
public String getMaxTotal() { | ||
return maxTotal; | ||
} | ||
|
||
public void setMaxTotal(String maxTotal) { | ||
this.maxTotal = maxTotal; | ||
} | ||
|
||
public String getTimeout() { | ||
return timeout; | ||
} | ||
|
||
public void setTimeout(String timeout) { | ||
this.timeout = timeout; | ||
} | ||
|
||
public String getSessionTimeout() { | ||
return sessionTimeout; | ||
} | ||
|
||
public void setSessionTimeout(String sessionTimeout) { | ||
this.sessionTimeout = sessionTimeout; | ||
} | ||
|
||
public String getFilterThreadNum() { | ||
return filterThreadNum; | ||
} | ||
|
||
public void setFilterThreadNum(String filterThreadNum) { | ||
this.filterThreadNum = filterThreadNum; | ||
} | ||
} |
105 changes: 105 additions & 0 deletions
105
sermant-backend/src/main/java/com/huaweicloud/sermant/backend/common/conf/CommonConst.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* 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 com.huaweicloud.sermant.backend.common.conf; | ||
|
||
/** | ||
* 公共配置常量 | ||
* | ||
* @author xuezechao | ||
* @since 2023-03-02 | ||
*/ | ||
public class CommonConst { | ||
|
||
/** | ||
* 钉钉webhook名称 | ||
*/ | ||
public static final String DINGDING_WEBHOOK_NAME = "DingDing"; | ||
|
||
/** | ||
* 钉钉webhook id | ||
*/ | ||
public static final int DINGDING_WEBHOOK_ID = 1; | ||
|
||
/** | ||
* 飞书webhook名称 | ||
*/ | ||
public static final String FEISHU_WEBHOOK_NAME = "Feishu"; | ||
|
||
/** | ||
* 飞书webhook id | ||
*/ | ||
public static final int FEISHU_WEBHOOK_ID = 0; | ||
|
||
/** | ||
* welink WEBHOOK名称 | ||
*/ | ||
public static final String WELINK_WEBHOOK_NAME = "Welink"; | ||
|
||
/** | ||
* welink WEBHOOK id | ||
*/ | ||
public static final int WELINK_WEBHOOK_ID = 2; | ||
|
||
/** | ||
* 默认redis地址 | ||
*/ | ||
public static final String DEFAULT_REDIS_ADDRESS = "127.0.0.1"; | ||
|
||
/** | ||
* 默认redis端口 | ||
*/ | ||
public static final int DEFAULT_REDIS_PORT = 6379; | ||
|
||
/** | ||
* redis 实例元数据key | ||
*/ | ||
public static final String REDIS_HASH_KEY_OF_INSTANCE_META = "sermant_meta"; | ||
|
||
/** | ||
* redis 事件key | ||
*/ | ||
public static final String REDIS_EVENT_KEY = "sermant_events_hash"; | ||
|
||
/** | ||
* redis 事件field集合的key | ||
*/ | ||
public static final String REDIS_EVENT_FIELD_SET_KEY = "sermant_event_keyset"; | ||
|
||
/** | ||
* redis 全匹配字符* | ||
*/ | ||
public static final String FULL_MATCH_KEY = ".*"; | ||
|
||
/** | ||
* 拼接redis key 字符 | ||
*/ | ||
public static final String JOIN_REDIS_KEY = "_"; | ||
|
||
/** | ||
* redis 地址切分字符 | ||
*/ | ||
public static final String REDIS_ADDRESS_SPLIT = ":"; | ||
|
||
/** | ||
* 前端页面事件每页展示默认数量 | ||
*/ | ||
public static final int DEFAULT_PAGE_SIZE = 10; | ||
|
||
private CommonConst() { | ||
|
||
} | ||
} |
Oops, something went wrong.