Skip to content

Commit

Permalink
feat(sdk): Display product information and Kraken information (#64)
Browse files Browse the repository at this point in the history
* return product name

* retrieve value from configuration
  • Loading branch information
kuangxiang20240501 authored Nov 5, 2024
1 parent aba159d commit d2f5924
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class MgmtProperty {
private boolean enabled;
private String defaultEnv = "stage";
private boolean mgmtServerEnabled = false;
private String productName = "";

private APIToken apiToken = new APIToken();
private String buyerTokenExpiredSeconds = DEFAULT_TOKEN_EXPIRED_SECONDS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ public class SystemInfo extends AbstractModel {
String status;
String productionAppVersion;
String stageAppVersion;
String productName;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.consoleconnect.kraken.operator.controller.entity.SystemInfoEntity;
import com.consoleconnect.kraken.operator.controller.enums.SystemStateEnum;
import com.consoleconnect.kraken.operator.controller.mapper.SystemInfoMapper;
import com.consoleconnect.kraken.operator.controller.model.MgmtProperty;
import com.consoleconnect.kraken.operator.controller.model.SystemInfo;
import com.consoleconnect.kraken.operator.controller.repo.SystemInfoRepository;
import com.consoleconnect.kraken.operator.core.dto.Tuple2;
Expand Down Expand Up @@ -38,6 +39,7 @@ public class SystemInfoService {

private final UnifiedAssetService unifiedAssetService;
private final SystemInfoRepository systemInfoRepository;
private final MgmtProperty mgmtProperty;

@Value("${spring.build.version}")
private String buildVersion;
Expand Down Expand Up @@ -165,6 +167,11 @@ public SystemInfo find() {
return systemInfoRepository
.findOneByKey(KEY)
.map(SystemInfoMapper.INSTANCE::toDto)
.map(
t -> {
t.setProductName(mgmtProperty.getProductName());
return t;
})
.orElseThrow(() -> KrakenException.notFound("System info not found"));
}
}

0 comments on commit d2f5924

Please sign in to comment.