[MGNLRESTCL-97] Instance-safe resolution of magnolia-base-path Created: 04/Nov/19  Updated: 28/Jun/22

Status: Accepted
Project: REST Client
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Martin Drápela Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
is caused by MGNLRESTCL-88 DOC: Page with REST v2 configuration ... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:
Epic Link: RestClient Maintenance

 Description   

Installing Magnolia with CLI means a neat single folder for all light dev code

magnolia.resources.dir=${magnolia.home}/../../../light-modules

for both instances, author and public.

Yet, this poses an issue how to reference a rest endpoint like this:

https://git.magnolia-cms.com/projects/MODULES/repos/rest-client/commits/8de6368cc972f453064e36e959e4107c1fd250f0#declarative-rest-demo/restEndpoints/countries.yaml

from a REST client definition like this one:

https://git.magnolia-cms.com/projects/MODULES/repos/rest-client/commits/8de6368cc972f453064e36e959e4107c1fd250f0#declarative-rest-demo/restClients/magnolia-stuff.yaml

where one feels the itching to replace the "rest" part of the path with either "magnoliaAuthor" or "magnoliaPublic", depending on which instance will in the end do the querying.

 

The user could at least use:

1) a path template, sth like

baseUrl: 'http://localhost:8080/{magnoliaInstance}/.rest'

and then, in the template script, resolve the value by using a context property.

 

2) a preconfigured (default) instance resolver like

baseUrl: 'http://localhost:8080/{instanceResolver}/.rest'

 with no extra need to care for this in the template script.

 

 



 Comments   
Comment by Mikaël Geljić [ 05/Nov/19 ]

Testing the rest-client by pointing to a rest-service living on the same webapp; one could say that's not a very realistic usage of rest-clients
Nonetheless we might verify if supporting environment variables in general would make sense in definitions (would be in a slightly bigger scope than rest-client though)

Comment by Christopher Zimmermann [ 05/Nov/19 ]

The example above appears to be a corner case because its just in the context of having a RestClient point at a Magnolia delivery endpoint. Typically they are pointing at external services.

Ideally we should allow people to get content from our delivery endpoints with something like a new templating funcdtion library like "deliveryfn" or something. But until then - some people will want to achive the above.

But I realize its not SUCH a corner case because devlopers will also face similar concern with other API's - wanting to hit different endpoints depending on Production or Development purposes. 

For example for contentful the production endpoint is http://delivery.contentful.com, but the preview API is http://preview.contentful.com.

Therefore I think the best solution is the proposed option #1 above. I should be able to template that baseURL.

Generated at Mon Feb 12 10:43:11 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.