How to compute/use a service url based on an 'app.getSharedData()' variable?

For easing my deployments, I thought of (re-)using a "global variable" defined via "app.getSharedData()" in application onStart event (containing a string) in my service urls.

Depending on server name (taken from url) the variable would contain either ".test" or nothing (""), so that my url would compute to "https://api.test.domain.de/signature" or "https://api.domain.de/signature".

As I cannot compute a service url in the "Service Configuration" dialog url field, has anyone an idea how to achieve this (ideally, without having to define 2 identical services differing only in the url)?

One of the techniques that I have used to do that is to call a service to another leap form that will return the url value. IN this way you can have the same form in both environments, with a different value, but the service to call the form stays the same.