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 deletion
—
download
Diffstat
Diff options
+7/-1
M app.py
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
|
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
|
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
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
|