Skip to content

Commit 877c37f

Browse files
committed
Modify config server configuration
1 parent 204ba08 commit 877c37f

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

config-server/src/main/resources/application.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ spring:
1010
# git:
1111
# uri: https://github.com/cevheri/microservices-config-server
1212
# clone-on-start: true
13+
# searchPaths: licensingservice,organizationservice
14+
# username: native-cloud-apps
15+
# password: 0ffended
16+
1317

1418
eureka:
1519
client:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
spring:
2+
application:
3+
name: config-server

person-service/src/main/resources/application.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ spring:
22
application:
33
name: person-service
44
zipkin:
5-
base-url: http://zipkin:9411/
5+
base-url: ${ZIPKIN_URI:http://zipkin:9411/}
66

77
server:
88
port: 9002
@@ -13,6 +13,19 @@ eureka:
1313
fetch-registry: true
1414
service-url:
1515
# defaultZone: http://localhost:8761/eureka/
16-
defaultZone: http://service-registry:8761/eureka/
16+
defaultZone: ${EUREKA_SERVER_URI:http://service-registry:8761/eureka/}
1717
instance:
18+
preferIpAddress: true
1819
hostname: service-registry
20+
# By default, Eureka will try to register the services that contact it by hostname. This
21+
#works well in a server-based environment where a service is assigned a DNS-backed
22+
#host name. However, in a container-based deployment (for example, Docker), con-
23+
#tainers will be started with randomly generated hostnames and no DNS entries for
24+
#the containers.
25+
#If you don’t set the eureka.instance.preferIpAddress to true, your client
26+
#applications won’t properly resolve the location of the hostnames because there will
27+
#be no DNS entry for that container. Setting the preferIpAddress attribute will
28+
#inform the Eureka service that client wants to be advertised by IP address.
29+
#Personally, we always set this attribute to true. Cloud-based microservices are sup-
30+
#posed to be ephemeral and stateless. They can be started up and shut down at will.
31+
#IP addresses are more appropriate for these types of services.

person-service/src/main/resources/bootstrap.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ spring:
22
cloud:
33
config:
44
enabled: true
5-
uri: http://config-server:9296
5+
uri: ${SPRING_CONFIG_URI:http://config-server:9296}

0 commit comments

Comments
 (0)