Skip to content

Commit e7bb134

Browse files
committed
Set up separate config values for host.main and host.reconcile
1 parent c1b0f6d commit e7bb134

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

app/controllers/HomeController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ static String returnAsJson(String q, SearchResponse queryResponse) {
467467
List<Map<String, Object>> hits = Arrays.asList(queryResponse.getHits().getHits()).stream()
468468
.map(hit -> hit.getSource()).collect(Collectors.toList());
469469
ObjectNode object = Json.newObject();
470-
object.put("@context", config("host") + routes.HomeController.context());
471-
object.put("id", config("host") + request().uri());
470+
object.put("@context", config("host.main") + routes.HomeController.context());
471+
object.put("id", config("host.main") + request().uri());
472472
object.put("totalItems", queryResponse.getHits().getTotalHits());
473473
object.set("member", Json.toJson(hits));
474474

app/controllers/Reconcile.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public Result main(String callback, String queries, String extend) {
104104
}
105105

106106
private ObjectNode metadata() {
107-
final String host = HomeController.config("host");
107+
final String host = HomeController.configNested("host", "reconcile");
108108
ObjectNode result = Json.newObject();
109109
result.putArray("versions").add("0.1").add("0.2");
110110
result.put("name", "GND reconciliation for OpenRefine");
@@ -151,7 +151,7 @@ private ObjectNode metadata() {
151151

152152
private ObjectNode suggestService(String suggest) {
153153
return Json.newObject()//
154-
.put("service_url", HomeController.config("host") + "/gnd/reconcile")//
154+
.put("service_url", HomeController.configNested("host", "reconcile"))//
155155
.put("service_path", "/suggest/" + suggest)//
156156
.put("flyout_service_path", "/flyout/" + suggest + "?id=${id}");
157157
}

app/views/preview.scala.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@(resource: String)
44

55
@import play.api.libs.json._
6-
@import controllers.HomeController.CONFIG
6+
@import controllers.HomeController.configNested
77

88
<html><head><meta charset="utf-8" /></head>
99
<body style="margin: 0px; font-family: Arial; sans-serif">
@@ -16,7 +16,7 @@
1616
details = elems.tail.mkString(" | ");
1717
fullId <- (json \ "id").asOpt[String];
1818
shortId = fullId.split("/").last;
19-
url = CONFIG.getString("host") + routes.HomeController.authority(shortId,null);
19+
url = configNested("host", "reconcile") + routes.HomeController.authority(shortId,null);
2020
cat <- (json \ "category").asOpt[String];
2121
image = (json \ "image").asOpt[String]) {
2222
@for(img <- image){

app/views/reconcile.scala.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ <h1>GND Reconciliation</h1>
2020

2121
<p>Dieser Dienst ermöglicht den Abgleich eigener Daten mit der Gemeinsamen Normdatei, insbesondere mit OpenRefine, einem nicht nur im Bibliotheksbereich weitverbreiteten Werkzeug. OpenRefine bietet zahlreiche Funktionalitäten zur Bereinigung und Transformation von Daten, sowie zum Abgleich (Reconciliation) mit externen Datenquellen und zur Anreicherung auf Basis der abgeglichenen Daten. Dieser Dienst stellt die GND als eine solche Datenquelle in OpenRefine bereit. Der Dienst kann zugleich auch in anderen Anwendungen verwendet werden, z. B. im Bibliotheksmanagementsystem Alma über Alma Refine (s. <a href="https://reconciliation-api.github.io/census/clients/">weitere Clients</a>).</p>
2222

23-
<p>Service-URL: <code>@controllers.HomeController.config("host")</code></p>
23+
<p>Service-URL: <code>@controllers.HomeController.configNested("host", "reconcile")</code></p>
2424

2525
<h2>Daten und Werkzeuge</h2>
2626

@@ -50,11 +50,11 @@ <h2>API</h2>
5050
<h3>Allgemeine API <small>(<a href="https://www.w3.org/community/reports/reconciliation/CG-FINAL-specs-0.2-20230410">spec</a>)</small></h3>
5151

5252
<p><b>Service</b><br/>
53-
<code>curl @controllers.HomeController.config("host")</code>
53+
<code>curl @controllers.HomeController.configNested("host", "reconcile")</code>
5454
<p><b>JSONP-callback</b><br/>
55-
<code>curl @controllers.HomeController.config("host")?callback=jsonp</code>
55+
<code>curl @controllers.HomeController.configNested("host", "reconcile")?callback=jsonp</code>
5656
<p><b>CORS-header</b><br/>
57-
<code>curl --head @controllers.HomeController.config("host") | grep Access-Control-Allow-Origin</code>
57+
<code>curl --head @controllers.HomeController.configNested("host", "reconcile") | grep Access-Control-Allow-Origin</code>
5858
</p>
5959

6060
<h3>View-API</h3>
@@ -66,7 +66,7 @@ <h3>Query-API <small>(<a href="https://www.w3.org/community/reports/reconciliati
6666

6767
@desc("Query: GET", routes.Reconcile.main(queries="{\"q1\":{\"query\":\"Twain, Mark\"}}"))
6868
<p><b>Query: POST</b><br/>
69-
<code>curl --data 'queries={"q1":{"query":"Twain, Mark"}}' @controllers.HomeController.config("host")</code></p>
69+
<code>curl --data 'queries={"q1":{"query":"Twain, Mark"}}' @controllers.HomeController.configNested("host", "reconcile")</code></p>
7070

7171
<h3>Suggest-API <small>(<a href="https://www.w3.org/community/reports/reconciliation/CG-FINAL-specs-0.2-20230410/#suggest-services">spec</a>)</small></h3>
7272

@@ -82,6 +82,6 @@ <h3>Data-extension-API</h3>
8282
@desc("Property-proposals (<a href=\"https://www.w3.org/community/reports/reconciliation/CG-FINAL-specs-0.2-20230410/#data-extension-property-proposals\">spec</a>)", routes.Reconcile.properties("","Work",""))
8383
@desc("Extend: GET (<a href=\"https://www.w3.org/community/reports/reconciliation/CG-FINAL-specs-0.2-20230410/#data-extension-service\">spec</a>)", routes.Reconcile.main(extend="{\"ids\":[\"1081942517\",\"4791358-7\"],\"properties\":[{\"id\":\"preferredName\"},{\"id\":\"firstAuthor\"}]}"))
8484
<p><b>Extend: POST</b><br/>
85-
<code>curl --data 'extend={"ids":["1081942517","4791358-7"],"properties":[{"id":"preferredName"},{"id":"firstAuthor"}]}' @controllers.HomeController.config("host")</code></p>
85+
<code>curl --data 'extend={"ids":["1081942517","4791358-7"],"properties":[{"id":"preferredName"},{"id":"firstAuthor"}]}' @controllers.HomeController.configNested("host", "reconcile")</code></p>
8686

8787
}

conf/application.conf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# This is the main configuration file for the application.
22
# https://www.playframework.com/documentation/latest/ConfigFile
33

4-
host : "https://reconcile.lobid.org"
4+
host {
5+
main: "https://lobid.org"
6+
reconcile: "https://reconcile.gnd.network"
7+
}
58

69
dontShowOnMainPage: ["1012979-0"]
710

0 commit comments

Comments
 (0)