Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
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-cloud-netflix
Commits
198cb599
Commit
198cb599
authored
Nov 25, 2014
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated sidecar so the health and info urls go to sidecar, but homepage and…
updated sidecar so the health and info urls go to sidecar, but homepage and non-secure-port go to local app
parent
dc12c235
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
3 deletions
+43
-3
pom.xml
spring-cloud-netflix-sidecar/pom.xml
+5
-0
LocalApplicationHealthIndicator.java
...loud/netflix/sidecar/LocalApplicationHealthIndicator.java
+1
-1
SidecarConfiguration.java
...framework/cloud/netflix/sidecar/SidecarConfiguration.java
+20
-0
SidecarProperties.java
...ingframework/cloud/netflix/sidecar/SidecarProperties.java
+3
-1
application.yml
...-cloud-netflix-sidecar/src/test/resources/application.yml
+14
-1
No files found.
spring-cloud-netflix-sidecar/pom.xml
View file @
198cb599
...
...
@@ -73,5 +73,10 @@
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-config-client
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
</project>
spring-cloud-netflix-sidecar/src/main/java/org/springframework/cloud/netflix/sidecar/LocalApplicationHealthIndicator.java
View file @
198cb599
...
...
@@ -19,7 +19,7 @@ public class LocalApplicationHealthIndicator extends AbstractHealthIndicator {
@SuppressWarnings
(
"unchecked"
)
@Override
protected
void
doHealthCheck
(
Health
.
Builder
builder
)
throws
Exception
{
URI
uri
=
properties
.
get
Local
HealthUri
();
URI
uri
=
properties
.
getHealthUri
();
if
(
uri
==
null
)
{
builder
.
up
();
return
;
...
...
spring-cloud-netflix-sidecar/src/main/java/org/springframework/cloud/netflix/sidecar/SidecarConfiguration.java
View file @
198cb599
package
org
.
springframework
.
cloud
.
netflix
.
sidecar
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -12,6 +14,8 @@ import org.springframework.context.annotation.Configuration;
@EnableConfigurationProperties
@ConditionalOnExpression
(
"${sidecar.enabled:true}"
)
public
class
SidecarConfiguration
{
@Value
(
"${server.port:${SERVER_PORT:${PORT:8080}}}"
)
private
int
serverPort
=
8080
;
@Bean
public
SidecarProperties
sidecarProperties
()
{
...
...
@@ -19,6 +23,22 @@ public class SidecarConfiguration {
}
@Bean
public
EurekaInstanceConfigBean
eurekaInstanceConfigBean
()
{
EurekaInstanceConfigBean
config
=
new
EurekaInstanceConfigBean
();
int
port
=
sidecarProperties
().
getPort
();
config
.
setNonSecurePort
(
port
);
String
scheme
=
config
.
getSecurePortEnabled
()?
"https"
:
"http"
;
config
.
setStatusPageUrl
(
scheme
+
"://"
+
config
.
getHostname
()
+
":"
+
serverPort
+
config
.
getStatusPageUrlPath
());
config
.
setHealthCheckUrl
(
scheme
+
"://"
+
config
.
getHostname
()
+
":"
+
serverPort
+
config
.
getHealthCheckUrlPath
());
config
.
setHomePageUrl
(
scheme
+
"://"
+
config
.
getHostname
()
+
":"
+
port
+
config
.
getHomePageUrlPath
());
return
config
;
}
@Bean
public
LocalApplicationHealthIndicator
localApplicationHealthIndicator
()
{
return
new
LocalApplicationHealthIndicator
();
}
...
...
spring-cloud-netflix-sidecar/src/main/java/org/springframework/cloud/netflix/sidecar/SidecarProperties.java
View file @
198cb599
...
...
@@ -11,5 +11,7 @@ import java.net.URI;
@Data
@ConfigurationProperties
(
"sidecar"
)
public
class
SidecarProperties
{
private
URI
localHealthUri
;
private
URI
healthUri
;
private
URI
homePageUri
;
private
int
port
;
}
spring-cloud-netflix-sidecar/src/test/resources/application.yml
View file @
198cb599
...
...
@@ -5,7 +5,20 @@ spring:
name
:
sidecarTest
sidecar
:
local-health-uri
:
http://localhost:8081/health
port
:
8000
health-uri
:
http://localhost:8000/src/test/resources/health.json
eureka
:
instance
:
app-group-name
:
mysidecargroup
endpoints
:
refresh
:
enabled
:
true
shutdown
:
enabled
:
true
health
:
sensitive
:
false
zuul
:
proxy
:
...
...
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