Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed issue#264 #279

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.tencent.tsf.femas.agent.classloader.AgentClassLoader;
import com.tencent.tsf.femas.agent.classloader.AgentPackagePathScanner;
import com.tencent.tsf.femas.agent.classloader.InterceptorClassLoaderCache;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.Yaml;
Expand All @@ -22,12 +23,22 @@ public class AgentConfig {
private final static String filePath = "/config/femas.yaml";
private static final Yaml yml = new Yaml();
private static Map<String, Object> conf = new ConcurrentHashMap<>();

static {
FileReader reader = null;
try {
reader = new FileReader(AgentPackagePathScanner.getPath() + filePath);
BufferedReader buffer = new BufferedReader(reader);
conf = yml.load(buffer);
//If there is a configuration in the system variable, overwrite the configuration in the femas.yaml file
if (null != conf && !conf.isEmpty()) {
conf.forEach((k, v) -> {
String value = System.getProperty(k);
if (StringUtils.isNotBlank(value)) {
conf.put(k, value);
}
});
}
} catch (FileNotFoundException e) {
logger.info("load agent Config failed, 'femas.yaml' file not found");
} catch (Exception e) {
Expand Down