Merge branch 'master' of gitea@code-repo.d4science.org:gCubeSystem/resource-registry-api.git
This commit is contained in:
commit
d52621961c
|
@ -0,0 +1,27 @@
|
|||
package org.gcube.informationsystem.resourceregistry.api.rest;
|
||||
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public abstract class ServiceInstance {
|
||||
|
||||
private static final String PROD_ROOT_SCOPE = "/d4science.research-infrastructures.eu";
|
||||
|
||||
public static final String BASE_URL = "https://url.d4science.org";
|
||||
|
||||
public static String getServiceURL() {
|
||||
String context = ScopeProvider.instance.get();
|
||||
return getServiceURL(context);
|
||||
}
|
||||
|
||||
public static String getServiceURL(String context) {
|
||||
if(context.startsWith(PROD_ROOT_SCOPE)) {
|
||||
return BASE_URL;
|
||||
}
|
||||
String root = context.split("/")[1];
|
||||
return BASE_URL.replace("url", "url." + root.replaceAll("\\.", "-"));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue