diff --git a/app.py b/app.py index 7e7062c..8c94ea8 100755 --- a/app.py +++ b/app.py @@ -5,6 +5,7 @@ import datetime import dateutil import functools import jinja2 +import os import pathlib import pyld import re @@ -13,6 +14,11 @@ import requests from bottle import jinja2_template as template, request, response from string import Template +# Check that we have an endpoint for querying +FUSEKI_ENDPOINT = os.environ.get('FUSEKI_ENDPOINT') +if not FUSEKI_ENDPOINT: + raise Exception('FUSEKI_ENDPOINT environment variable not set.') + # This only exists for exporting the bottle app object for a WSGI server such as Gunicorn application = bottle.app() @@ -26,7 +32,7 @@ def query(query_string, jsonld_frame=None): """ http_request = requests.post( - 'http://localhost:3030/dokk?default-graph-uri=urn:x-arq:UnionGraph', + FUSEKI_ENDPOINT, data = { 'format': 'json', 'query': query_string}) results = http_request.json() diff --git a/website.service b/website.service index 0586f33..5c52480 100644 --- a/website.service +++ b/website.service @@ -11,6 +11,9 @@ Description=DOKK website app After=network.target [Service] +# URI to Fuseki endpoint for querying +Environment=FUSEKI_ENDPOINT=https://example.org:3030/dokk + ExecStart=/home/fuseki/dokk.org/venv/bin/gunicorn --bind localhost:8080 app:application User=fuseki