Nacos supports configuration context path (#12558)
This commit is contained in:
parent
9e67130587
commit
ba8c0035cb
|
|
@ -54,6 +54,7 @@
|
|||
* Get endpoint list order by timestamp desc.
|
||||
* Support sort queries on metrics generated by eBPF receiver.
|
||||
* Fix the compatibility with Grafana 11 when using label_values query variables.
|
||||
* Nacos as config server and cluster coordinator supports configuration contextPath.
|
||||
|
||||
#### UI
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ The Configuration Vocabulary lists all available configurations provided by `app
|
|||
| - | - | namespace | Namespace used by SkyWalking node coordination. | SW_CLUSTER_NACOS_NAMESPACE | public |
|
||||
| - | - | internalComHost | The hostname registered in Nacos for internal communications of the OAP cluster. | SW_CLUSTER_INTERNAL_COM_HOST | - |
|
||||
| - | - | internalComPort | The port registered in Nacos for internal communications of the OAP cluster. | SW_CLUSTER_INTERNAL_COM_PORT | -1 |
|
||||
| - | - | contextPath | Nacos set contextPath. | SW_CLUSTER_NACOS_CONTEXT_PATH | - |
|
||||
| - | - | username | Nacos Auth username. | SW_CLUSTER_NACOS_USERNAME | - |
|
||||
| - | - | password | Nacos Auth password. | SW_CLUSTER_NACOS_PASSWORD | - |
|
||||
| - | - | accessKey | Nacos Auth accessKey. | SW_CLUSTER_NACOS_ACCESSKEY | - |
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ public class ClusterModuleNacosConfig extends ModuleConfig {
|
|||
private String namespace = "public";
|
||||
private String internalComHost;
|
||||
private int internalComPort = -1;
|
||||
private String contextPath;
|
||||
private String username;
|
||||
private String password;
|
||||
private String accessKey;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ public class ClusterModuleNacosProvider extends ModuleProvider {
|
|||
if (StringUtil.isNotEmpty(config.getUsername()) && StringUtil.isNotEmpty(config.getAccessKey())) {
|
||||
throw new ModuleStartException("Nacos Auth method should choose either username or accessKey, not both");
|
||||
}
|
||||
if (StringUtil.isNotEmpty(config.getContextPath())) {
|
||||
properties.put(PropertyKeyConst.CONTEXT_PATH, config.getContextPath());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(config.getUsername())) {
|
||||
properties.put(PropertyKeyConst.USERNAME, config.getUsername());
|
||||
properties.put(PropertyKeyConst.PASSWORD, config.getPassword());
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ public class NacosConfigWatcherRegister extends FetchingConfigWatcherRegister {
|
|||
final Properties properties = new Properties();
|
||||
properties.put(PropertyKeyConst.SERVER_ADDR, serverAddr + ":" + port);
|
||||
properties.put(PropertyKeyConst.NAMESPACE, settings.getNamespace());
|
||||
if (StringUtil.isNotEmpty(settings.getContextPath())) {
|
||||
properties.put(PropertyKeyConst.CONTEXT_PATH, settings.getContextPath());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(settings.getUsername())) {
|
||||
properties.put(PropertyKeyConst.USERNAME, settings.getUsername());
|
||||
properties.put(PropertyKeyConst.PASSWORD, settings.getPassword());
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ public class NacosServerSettings extends ModuleConfig {
|
|||
private int period = 60;
|
||||
private String username;
|
||||
private String password;
|
||||
private String contextPath;
|
||||
private String accessKey;
|
||||
private String secretKey;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ configuration:
|
|||
period: 1
|
||||
# the name of current cluster, set the name if you want to upstream system known.
|
||||
clusterName: "default"
|
||||
contextPath: '/nacos'
|
||||
# Nacos auth username
|
||||
username: 'nacos'
|
||||
password: 'nacos'
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ cluster:
|
|||
hostPort: ${SW_CLUSTER_NACOS_HOST_PORT:localhost:8848}
|
||||
# Nacos Naming namespace
|
||||
namespace: ${SW_CLUSTER_NACOS_NAMESPACE:"public"}
|
||||
contextPath: ${SW_CLUSTER_NACOS_CONTEXT_PATH:""}
|
||||
# Nacos auth username
|
||||
username: ${SW_CLUSTER_NACOS_USERNAME:""}
|
||||
password: ${SW_CLUSTER_NACOS_PASSWORD:""}
|
||||
|
|
|
|||
Loading…
Reference in New Issue