amenezes / config-client

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

Cloud Foundry - Space name not used to set profile #25

Closed atuldalvi closed 4 years ago

atuldalvi commented 4 years ago

On initializing a CF object, profile is not set using the Cloud foundry space name which then defaults to 'development'. This causes the config for development to be fetched for all other environments.

Below code needs to be updated in __attrs_post_init__ function of CF to set profile based on the space name to construct the correct config-server url.

        if not self.client:
            self.client = ConfigClient(
                address=self.cfenv.configserver_uri(),
                app_name=self.cfenv.application_name,
                profile=self.cfenv.space_name.lower() ##Set profile based on space name.
            )
amenezes commented 4 years ago

@atuldalvi,

I generated a new version with this fix. Thanks for your contribution. 👍