question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Eureka default zone setting is not picked up when using environment variables

See original GitHub issue

springBootVersion = ‘2.0.0.M7’ springCloudVersion = ‘Finchley.M5’

docker-compose setup (stripped down):

mongo:
  ports:
      - 27017:27017
eureka:
  ports:
      - 8761:8761
test-client:
  ports:
      - 8080:8080
  environment:
      SPRING_DATA_MONGODB_HOST: "mongo"
      EUREKA_INSTANCE_PREFER_IP_ADDRESS: "true"
      EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: "http://eureka:8761/eureka/"

The EUREKA_CLIENT_SERVICEURL_DEFAULTZONE environment variable is not picked up. Others, like the mongo host work ok.

Moving the setting inside the test-client application.properties works: eureka.client.service-url.defaultZone=http://eureka:8761/eureka/

I think it might be something caused by the naming of defaultZone (the service-url binds to a Map<String,String> and I don’t think the rezolver handles correctly the camelCase in defaultZone)

Probably related to https://github.com/spring-projects/spring-boot/issues/8902

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

9reactions
Hronomcommented, Apr 15, 2018

Ok, guys here is the workaround for this, this is my eureka-service.properties:

management.security.enabled=false
management.info.git.mode=full

eureka.client.region=default
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true

# https://github.com/spring-cloud/spring-cloud-netflix/issues/2541
eureka.client.service-url.defaultZone=${SERVICE_URL_DEFAULT_ZONE}

And then I’m able set eureka.client.service-url.defaultZone through environment variable SERVICE_URL_DEFAULT_ZONE.

Looks creepy, but it works!

7reactions
Hronomcommented, Jan 28, 2019

@spencergibb the proposed solution is temporary workaround, it’s not a solution for initial problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring Spring Eureka Client through environmental ...
I have tried a few variable names: eureka.instance.hostname. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE. eureka.client.serviceUrl.defaultZone. I also ...
Read more >
2. Service Discovery: Eureka Server - Spring Cloud
This section describes how to set up a Eureka server. ... page for details on setting up your build system with the current...
Read more >
Spring Cloud discussion and questions - Gitter
Question for the masses about registering an app with Eureka on startup -- if I have eureka.client.service-url.defaultZone set in my application.properties ...
Read more >
eureka-js-client - npm Package Health Analysis - Snyk
A JavaScript implementation the Netflix OSS service registry, Eureka. For more information about how to use this package see README.
Read more >
RE: Added RunConfigurations as Project Files for IntelliJ-Apache ...
The environment variables here are only needed for development purposes. ... checks if the env "eureka.address" is set and if not, the default...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found