I have created a PCF Config Server Service in PCF. when i deploy my springboot app that acts as a Config service client, deploy to PCF and bind it to the Config server service, it seamlessly pulls the configs and all is good.
My issue is, I am unable to connect to the PCF Config Server from my springboot app while running the app locally from my laptop.
Based on various documentation I created the Service Key for my Config Server service and modified my bootstrap.yml as below.
I am getting 401 Unauthorized error. INFO 22180 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: https://config-8660fe8f-2b6b-4171-bd7f-36f3a60ec48a.apps.pcfepg2wi.gm.com WARN 22180 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: 401 Unauthorized INFO 22180 --- [ main] com.gm.mms.extfile.Application : tartupProfileInfo - The following profiles are active: dev
spring:
application:
name: external-file-service
profiles:
active: dev
cloud:
config:
uri: https://config-8660fe8f-2b6b-4171-bd7f-
36f3a60ec48a.apps.pcfepg2wi.gm.com
username: <username-here>
password: <password-here>
client_secret: RwKMmAhOzuz8
client_id: p-config-server-ebcd8a29-2615-4924-88bb-b4188d50d2b5
access_token_uri: https://p-spring-cloud-
services.uaa.sys.pcfepg2wi.gm.com/oauth/token
label: develop
security:
basic:
enabled: false
Note: Not sure you can connect any PCF marketplace service from local if Firewall rules are setup to disable the external connectivity.
If there is no connectivity issue then you should you be able to connect it using following workaround(worked for me)
Add following environment variables in your Spring Boot App Configuration
json
in your PCF
app Environment Variables
under application_env_json
) json
in your PCF
app Environment Variables
under system_env_json
) You can use this website to format JSON
data [Select Compact
JSON Template]