Skip to content

Commit

Permalink
fix the apollo version logic by reading the server version instead of…
Browse files Browse the repository at this point in the history
… the apollo-core version
  • Loading branch information
nobodyiam committed Mar 17, 2024
1 parent a73d032 commit e3cd67d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2022 Apollo Authors
*
* 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.ctrip.framework.apollo.common.constants;

/**
* @author Jason Song(song_s@ctrip.com)
*/
public class ApolloServer {
public final static String VERSION =
"java-" + ApolloServer.class.getPackage().getImplementationVersion();
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
*/
package com.ctrip.framework.apollo.common.controller;

import com.ctrip.framework.apollo.Apollo;
import com.ctrip.framework.apollo.common.constants.ApolloServer;
import com.ctrip.framework.foundation.Foundation;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

Expand All @@ -38,6 +37,6 @@ public String getServer() {

@RequestMapping("version")
public String getVersion() {
return Apollo.VERSION;
return ApolloServer.VERSION;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
*/
package com.ctrip.framework.apollo.portal.controller;

import com.ctrip.framework.apollo.Apollo;
import com.ctrip.framework.apollo.portal.environment.PortalMetaDomainService;
import com.ctrip.framework.apollo.common.constants.ApolloServer;
import com.ctrip.framework.apollo.core.dto.ServiceDTO;
import com.ctrip.framework.apollo.portal.environment.Env;
import com.ctrip.framework.apollo.portal.component.PortalSettings;
import com.ctrip.framework.apollo.portal.component.RestTemplateFactory;
import com.ctrip.framework.apollo.portal.entity.vo.EnvironmentInfo;
import com.ctrip.framework.apollo.portal.entity.vo.SystemInfo;
import com.ctrip.framework.apollo.portal.environment.Env;
import com.ctrip.framework.apollo.portal.environment.PortalMetaDomainService;
import java.util.List;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.actuate.health.Health;
Expand All @@ -34,9 +36,6 @@
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.PostConstruct;
import java.util.List;

@RestController
@RequestMapping("/system-info")
public class SystemInfoController {
Expand Down Expand Up @@ -70,7 +69,7 @@ private void init() {
public SystemInfo getSystemInfo() {
SystemInfo systemInfo = new SystemInfo();

String version = Apollo.VERSION;
String version = ApolloServer.VERSION;
if (isValidVersion(version)) {
systemInfo.setVersion(version);
}
Expand Down

0 comments on commit e3cd67d

Please sign in to comment.