Hi there!,
I'm attempting local development using the apigee setup described in the docs (VS code, docker etc) but I can't seem to get any property sets to work in target endpoint definitions.
For example: I have a property set called `system.properties` with a key value such as:
endpoints.ct.path=somepath
<TargetEndpoint name="default">
<HTTPTargetConnection>
<LoadBalancer>
<Server name="server0"/>
</LoadBalancer>
<Path>/{propertyset.system.endpoints.ct.path}</Path>
</HTTPTargetConnection>
</TargetEndpoint>
All calls that I make result in:
{"fault":{"faultstring":"Illegal propertyset keysystem.endpoints.ct.path","detail":{"errorcode":"Bad Request"}}}
I have tried all manner of combinations to get this to work (e.g. propertyset.system.properties.endpoints.ct.path, propertyset.endpoints.ct.path) but to no avail.
What I'm trying to achieve is a per-env deployment configuration (different servers managed via targets but different paths via propertysets).
Has anyone come across a solution or know how to debug this?
Cheers!
As per this page https://cloud.google.com/apigee/docs/api-platform/cache/property-sets
"The property set name and property name cannot have dots in them." so you cannot use "endpoints.ct.path=..." for example.
Fantastic - I totally missed that bit as I had read the 'java properties' and away I went. I'll give it a whirl.
Thanks @dknezic !
I use underlines.
The restriction against dots seems arbitrary, but ok. I can use underlines as a separator.
So made the change and it's not complaining about the format anymore which is ace, so I've updated my config to specify the URL in HTTPTargetConnection to be the following:
<TargetEndpoint name="default">
<HTTPTargetConnection>
<URL>https://{propertyset.system.endpoints_server_host}/{propertyset.system.endpoints_server_path}</URL>
</HTTPTargetConnection>
</TargetEndpoint>
based upon what I had seen in this answer:
When I test this locally, the value is not being replaced:
{"level":"WARNING","thread":"NIOThread@0","mdc":{"messageId":"4ea537fe-13e4-4305-8081-3a45f10d825b1","apiName":"commerce-tools","env":"dev","org":"hybrid","revision":"0"},"className":"com.apigee.httpclient.DNSCache$2","method":"failed","severity":"WARNING","message":"Failed to resolve hostname {propertyset.system.endpoints_server_host}. Reason {propertyset.system.endpoints_server_host}: Name or service not known. This log message will snooze for 2 hours [ERROR: UNUSED LOG ARGUMENTS] [CONTEXT ratelimit_period\u003d\"2 HOURS\" ]","formattedDate":"2021-11-26T09:40:32.931Z","logger":"SERVICES.HTTPCLIENTSERVICE"}
Hmmm...... I would have thought that would work. Let me look into it.
Awesome - thanks for the followup @dchiesa1 - let me know if you need anything from my side
<HTTPTargetConnection>
<URL>http://{backend_url}</URL>
</HTTPTargetConnection>
<HTTPTargetConnection>
<URL>http://apigee.com/{backend_path}</URL>
</HTTPTargetConnection>
<TargetEndpoint name="default">
<HTTPTargetConnection>
<!-- <URL>https://mocktarget.apigee.net/xml</URL> -->
<URL>https://mocktarget.apigee.net/{propertyset.targetnameps.target_url}</URL>
</HTTPTargetConnection>
</TargetEndpoint>
And for truly dynamic URLs, you can also set "target.url" in the target request flow. That will override the configuration in the HTTPTargetConnection in the TargetEndpoint.