amenezes / config-client

config-client package for spring cloud config and cloud foundry
https://config-client.amenezes.net/
Apache License 2.0
24 stars 17 forks source link

Support for p.config-server (v 3.x) #37

Closed atuldalvi closed 3 years ago

atuldalvi commented 4 years ago

The library is failing for 3.x config server service instances (p.config-server).

I tried your suggestion from issue #35 as below but it still does not work.

from config.cf import CF
from config.cfenv import CFenv

cf = CF(cfenv=CFenv(vcap_service_prefix="p.config-server"))
cf.get_config()

The issue appears to be with the path supplied to glom for accessing credentials from vcap_services. Due to a dot in the service prefix name (p.config-server), glom expands path to the json properties incorrectly (like "p.config-server.0.credentials.uri") and is unable to read the value.

Updating _format_vcap_path function in cfenv.py as below would address the problem.

from glom import Path

def _format_vcap_path(self, path: str) -> Any:
   path = path[1:]
   return Path(Path(self.vcap_service_prefix),Path.from_text(path))
amenezes commented 4 years ago

Thanks for the info @atuldalvi I will investigate this issue.

amenezes commented 3 years ago

@atuldalvi could you try use this version to confirm the issue fix: https://pypi.org/project/config-client/0.11.1a3/

amenezes commented 3 years ago

fixed in version 0.11.1