home » zplus/dokk.org.git
Author zPlus <zplus@peers.community> 2024-06-20 08:55:44
Committer zPlus <zplus@peers.community> 2024-06-20 08:55:44
Commit 33f6c91 (patch)
Tree 6019cbd
Parent(s)

Add FUSEKI_ENDPOINT environment variable. The URI to the Fuseki endpoint was hard coded, so it's been moved to an environment variable.


commits diff: 7be84ef..33f6c91
2 files changed, 10 insertions, 1 deletiondownload


Diffstat
-rwxr-xr-x app.py 8
-rw-r--r-- website.service 3

Diff options
View
Side
Whitespace
Context lines
Inter-hunk lines
+7/-1 M   app.py
index 7e7062c..8c94ea8
old size: 12K - new size: 12K
@@ -5,6 +5,7 @@ import datetime
5 5 import dateutil
6 6 import functools
7 7 import jinja2
8 + import os
8 9 import pathlib
9 10 import pyld
10 11 import re
@@ -13,6 +14,11 @@ import requests
13 14 from bottle import jinja2_template as template, request, response
14 15 from string import Template
15 16
17 + # Check that we have an endpoint for querying
18 + FUSEKI_ENDPOINT = os.environ.get('FUSEKI_ENDPOINT')
19 + if not FUSEKI_ENDPOINT:
20 + raise Exception('FUSEKI_ENDPOINT environment variable not set.')
21 +
16 22 # This only exists for exporting the bottle app object for a WSGI server such as Gunicorn
17 23 application = bottle.app()
18 24
@@ -26,7 +32,7 @@ def query(query_string, jsonld_frame=None):
26 32 """
27 33
28 34 http_request = requests.post(
29 - 'http://localhost:3030/dokk?default-graph-uri=urn:x-arq:UnionGraph',
35 + FUSEKI_ENDPOINT,
30 36 data = { 'format': 'json', 'query': query_string})
31 37
32 38 results = http_request.json()

+3/-0 M   website.service
index 0586f33..5c52480
old size: 513B - new size: 610B
@@ -11,6 +11,9 @@ Description=DOKK website app
11 11 After=network.target
12 12
13 13 [Service]
14 + # URI to Fuseki endpoint for querying
15 + Environment=FUSEKI_ENDPOINT=https://example.org:3030/dokk
16 +
14 17 ExecStart=/home/fuseki/dokk.org/venv/bin/gunicorn --bind localhost:8080 app:application
15 18
16 19 User=fuseki