Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-boot-admin
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-boot-admin
Commits
c8a1ae9e
Commit
c8a1ae9e
authored
Nov 16, 2016
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.4.x'
parents
a99a889a
79eb9496
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
AdminClientProperties.java
...ntric/boot/admin/client/config/AdminClientProperties.java
+8
-5
AdminClientPropertiesTest.java
...c/boot/admin/client/config/AdminClientPropertiesTest.java
+14
-0
No files found.
spring-boot-admin-starter-client/src/main/java/de/codecentric/boot/admin/client/config/AdminClientProperties.java
View file @
c8a1ae9e
...
@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.actuate.autoconfigure.ManagementServerProperties
;
import
org.springframework.boot.actuate.autoconfigure.ManagementServerProperties
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.context.embedded.Ssl
;
import
org.springframework.boot.context.event.ApplicationReadyEvent
;
import
org.springframework.boot.context.event.ApplicationReadyEvent
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.context.event.EventListener
;
...
@@ -94,8 +95,9 @@ public class AdminClientProperties {
...
@@ -94,8 +95,9 @@ public class AdminClientProperties {
"serviceUrl must be set when deployed to servlet-container"
);
"serviceUrl must be set when deployed to servlet-container"
);
}
}
return
UriComponentsBuilder
.
newInstance
().
scheme
(
getScheme
()).
host
(
getServiceHost
())
return
UriComponentsBuilder
.
newInstance
().
scheme
(
getScheme
(
server
.
getSsl
()))
.
port
(
serverPort
).
path
(
server
.
getContextPath
()).
toUriString
();
.
host
(
getServiceHost
()).
port
(
serverPort
).
path
(
server
.
getContextPath
())
.
toUriString
();
}
}
public
String
getManagementUrl
()
{
public
String
getManagementUrl
()
{
...
@@ -110,7 +112,8 @@ public class AdminClientProperties {
...
@@ -110,7 +112,8 @@ public class AdminClientProperties {
.
toUriString
();
.
toUriString
();
}
}
return
UriComponentsBuilder
.
newInstance
().
scheme
(
getScheme
()).
host
(
getManagementHost
())
Ssl
ssl
=
management
.
getSsl
()
!=
null
?
management
.
getSsl
()
:
server
.
getSsl
();
return
UriComponentsBuilder
.
newInstance
().
scheme
(
getScheme
(
ssl
)).
host
(
getManagementHost
())
.
port
(
managementPort
).
path
(
management
.
getContextPath
()).
toUriString
();
.
port
(
managementPort
).
path
(
management
.
getContextPath
()).
toUriString
();
}
}
...
@@ -151,8 +154,8 @@ public class AdminClientProperties {
...
@@ -151,8 +154,8 @@ public class AdminClientProperties {
return
preferIp
;
return
preferIp
;
}
}
private
String
getScheme
()
{
private
String
getScheme
(
Ssl
ssl
)
{
return
s
erver
.
getSsl
()
!=
null
&&
server
.
getSsl
()
.
isEnabled
()
?
"https"
:
"http"
;
return
s
sl
!=
null
&&
ssl
.
isEnabled
()
?
"https"
:
"http"
;
}
}
private
String
getHost
(
InetAddress
address
)
{
private
String
getHost
(
InetAddress
address
)
{
...
...
spring-boot-admin-starter-client/src/test/java/de/codecentric/boot/admin/client/config/AdminClientPropertiesTest.java
View file @
c8a1ae9e
...
@@ -135,6 +135,20 @@ public class AdminClientPropertiesTest {
...
@@ -135,6 +135,20 @@ public class AdminClientPropertiesTest {
}
}
@Test
@Test
public
void
test_ssl_managment
()
{
load
(
"management.ssl.key-store=somefile.jks"
,
"management.ssl.key-store-password=password"
,
"local.server.port=8080"
,
"local.management.port=9090"
);
AdminClientProperties
clientProperties
=
context
.
getBean
(
AdminClientProperties
.
class
);
publishApplicationReadyEvent
(
clientProperties
);
assertThat
(
clientProperties
.
getManagementUrl
(),
is
(
"https://"
+
getHostname
()
+
":9090"
));
assertThat
(
clientProperties
.
getHealthUrl
(),
is
(
"https://"
+
getHostname
()
+
":9090/health"
));
assertThat
(
clientProperties
.
getServiceUrl
(),
is
(
"http://"
+
getHostname
()
+
":8080"
));
}
@Test
public
void
test_preferIpAddress_serveraddress_missing
()
{
public
void
test_preferIpAddress_serveraddress_missing
()
{
load
(
"spring.boot.admin.client.prefer-ip=true"
,
"local.server.port=8080"
);
load
(
"spring.boot.admin.client.prefer-ip=true"
,
"local.server.port=8080"
);
AdminClientProperties
clientProperties
=
context
.
getBean
(
AdminClientProperties
.
class
);
AdminClientProperties
clientProperties
=
context
.
getBean
(
AdminClientProperties
.
class
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment