forked from alibaba/nacos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
178 additions
and
12 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
common/src/main/java/com/alibaba/nacos/common/util/VersionUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.alibaba.nacos.common.util; | ||
|
||
import java.io.InputStream; | ||
import java.util.Properties; | ||
|
||
/** | ||
* @author xingxuechao | ||
* on:2019/2/27 12:32 PM | ||
*/ | ||
public class VersionUtils { | ||
|
||
public static String VERSION; | ||
/**获取当前version*/ | ||
public static final String VERSION_DEFAULT = "${pom.version}"; | ||
|
||
|
||
static{ | ||
try{ | ||
InputStream in = VersionUtils.class.getClassLoader() | ||
.getResourceAsStream("nacos-version.txt"); | ||
Properties props = new Properties(); | ||
props.load(in); | ||
String val = props.getProperty("version"); | ||
if (val != null && !VERSION_DEFAULT.equals(val)) { | ||
VERSION = val; | ||
} | ||
} catch(Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
console/src/main/java/com/alibaba/nacos/console/controller/ServerStateController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright 1999-2018 Alibaba Group Holding Ltd. | ||
* | ||
* 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.alibaba.nacos.console.controller; | ||
|
||
|
||
import com.alibaba.nacos.common.util.VersionUtils; | ||
import com.alibaba.nacos.core.utils.SystemUtils; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author xingxuechao | ||
* on:2019/2/27 11:17 AM | ||
*/ | ||
@RestController | ||
@RequestMapping("/v1/console/server") | ||
public class ServerStateController { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(ServerStateController.class); | ||
|
||
|
||
public static String VERSION ; | ||
|
||
|
||
@ResponseBody | ||
@RequestMapping(value = "state", method = RequestMethod.GET) | ||
public ResponseEntity serverState() { | ||
Map<String,String> serverState = new HashMap<String, String>(3); | ||
serverState.put("standalone_mode",SystemUtils.STANDALONE_MODE ? | ||
SystemUtils.STANDALONE_MODE_ALONE : SystemUtils.STANDALONE_MODE_CLUSTER); | ||
|
||
serverState.put("function_mode", SystemUtils.FUNCTION_MODE); | ||
serverState.put("version", VersionUtils.VERSION); | ||
|
||
return ResponseEntity.ok().body(serverState); | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,40 @@ | ||
# spring | ||
|
||
server.contextPath=/nacos | ||
server.servlet.contextPath=/nacos | ||
server.port=8848 | ||
|
||
nacos.cmdb.dumpTaskInterval=3600 | ||
nacos.cmdb.eventTaskInterval=10 | ||
nacos.cmdb.labelTaskInterval=300 | ||
nacos.cmdb.loadDataAtStart=false | ||
|
||
|
||
# metrics for prometheus | ||
#management.endpoints.web.exposure.include=* | ||
|
||
# metrics for elastic search | ||
management.metrics.export.elastic.enabled=false | ||
#management.metrics.export.elastic.host=http://localhost:9200 | ||
|
||
# metrics for influx | ||
management.metrics.export.influx.enabled=false | ||
#management.metrics.export.influx.db=springboot | ||
#management.metrics.export.influx.uri=http://localhost:8086 | ||
#management.metrics.export.influx.auto-create-db=true | ||
#management.metrics.export.influx.consistency=one | ||
#management.metrics.export.influx.compressed=true | ||
|
||
server.tomcat.accesslog.enabled=true | ||
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D | ||
# default current work dir | ||
server.tomcat.basedir= | ||
|
||
## spring security config | ||
### turn off security | ||
#spring.security.enabled=false | ||
#management.security=false | ||
#security.basic.enabled=false | ||
#nacos.security.ignore.urls=/** | ||
|
||
nacos.security.ignore.urls=/,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/login,/v1/console/health/**,/v1/cs/**,/v1/ns/**,/v1/cmdb/**,/actuator/**,/v1/console/server/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version=${pom.version} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters