Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
CH3CHO authored Feb 26, 2024
2 parents 37034cc + eeccc86 commit 7af6e3d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/frontend @songpengyuan @abuexclusive @CH3CHO
/backend @xiangxiuhui @CH3CHO
/frontend @songpengyuan @CH3CHO
/backend @CH3CHO @slievrly
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*/
package com.alibaba.higress.console.service;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
Expand Down Expand Up @@ -41,12 +43,7 @@ public class SystemServiceImpl implements SystemService {
static {
String commitId = null;
try {
Properties properties = new Properties();
properties.load(SystemServiceImpl.class.getResourceAsStream("/git.properties"));
commitId = properties.getProperty("git.commit.id");
if (commitId != null && commitId.length() > 7) {
commitId = commitId.substring(0, 7);
}
commitId = loadGitCommitId();
} catch (Exception ex) {
log.error("Failed to load git properties.", ex);
}
Expand Down Expand Up @@ -90,4 +87,20 @@ public void initialize() {
public SystemInfo getSystemInfo() {
return new SystemInfo(fullVersion, capabilities);
}

private static String loadGitCommitId() throws IOException {
try (InputStream input = SystemServiceImpl.class.getResourceAsStream("/git.properties")) {
if (input == null) {
log.warn("git.properties not found.");
return null;
}
Properties properties = new Properties();
properties.load(input);
String commitId = properties.getProperty("git.commit.id");
if (commitId != null && commitId.length() > 7) {
commitId = commitId.substring(0, 7);
}
return commitId;
}
}
}

0 comments on commit 7af6e3d

Please sign in to comment.