56 lines
2.0 KiB
Java
56 lines
2.0 KiB
Java
package net.geedge.confagent.controller;
|
|
|
|
import cn.hutool.log.Log;
|
|
import net.geedge.confagent.util.Tool;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
public abstract class BaseController {
|
|
private Log log = Log.get();
|
|
|
|
protected static final String PROMTAIL_LISTEN_SERVER = "server";
|
|
protected static final String PROMTAIL_LISTEN_PORT = "http_listen_port";
|
|
|
|
@Value("${confagent.tokenFile:config/token.auth}")
|
|
protected String tokenFile; //token文件位置
|
|
|
|
@Value("${confagent.promtail.cmdLine}")
|
|
protected String promtailCmdLinePath; // promtail config.conf 启动参数文件存放位置
|
|
|
|
@Value("${confagent.promtail.defaultIP:127.0.0.1}")
|
|
protected String defaultPromtailIP; //promtail 默认监听ip
|
|
|
|
protected static final int DEFAULT_PROMTAIL_PORT=9080; //prometheus 默认监听端口
|
|
|
|
@Value("${confagent.promtail.config}")
|
|
protected String promtailConfPath;
|
|
|
|
@Value("${version}")
|
|
protected String currentVersion;
|
|
|
|
|
|
/**
|
|
* aes 对称加密 密钥
|
|
*/
|
|
public static final byte[] AES_SECRET_KEY = Tool.HexUtil.decodeHex("bde5430614b21baf1c53bd6f616d1a39");
|
|
|
|
/**
|
|
* 调用 /-/reload 接口,热加载 server 配置文件,
|
|
*
|
|
* @param cmdLinePath
|
|
* @param serverListenAddr
|
|
* @param defaultServerPort
|
|
* @param defaultServerIP
|
|
* @return
|
|
*/
|
|
// public boolean reloadServerConfiguration(String cmdLinePath, String serverListenAddr, int defaultServerPort, String defaultServerIP) {
|
|
// UrlBuilder serverReloadUrl = new UrlBuilder();
|
|
// int serverPort = ConfagentUtil.getConfFilePort(cmdLinePath, serverListenAddr, defaultServerPort);
|
|
// serverReloadUrl.setScheme("http").setHost(defaultServerIP).setPort(serverPort).addPath("/-/reload");
|
|
//
|
|
// String url = serverReloadUrl.toString();
|
|
// HttpRequest post = Tool.HttpUtil.createPost(url);
|
|
// HttpResponse response = post.execute();
|
|
// return 200 == response.getStatus();
|
|
// }
|
|
}
|