diff --git a/CHANGELOG.md b/CHANGELOG.md index 74b4f06..9ceb37b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [v2.15-1.2.1] + +### Added +- Environment vars for sparql endpoint and db admin username. + +### Fixed +- String decode error for 'file' type vocabularies. + ## [v2.15-1.2.0] ### Added @@ -32,3 +40,4 @@ Initial version [v2.15-1.0.0]: https://github.com/knaw-huc/sd-skosmos/releases/tag/v2.15-1.0-RC4 [v2.15-1.1.0]: https://github.com/knaw-huc/sd-skosmos/releases/tag/v2.15-1.1.0 [v2.15-1.2.0]: https://github.com/knaw-huc/sd-skosmos/releases/tag/v2.15-1.2.0 +[v2.15-1.2.1]: https://github.com/knaw-huc/sd-skosmos/releases/tag/v2.15-1.2.1 diff --git a/config-docker-compose.ttl b/config-docker-compose.ttl index 3ec3405..0abe9e7 100644 --- a/config-docker-compose.ttl +++ b/config-docker-compose.ttl @@ -19,8 +19,8 @@ # SPARQL endpoint # a local Fuseki server is usually on localhost:3030 # skosmos:sparqlEndpoint ; - skosmos:sparqlEndpoint ; - # skosmos:sparqlEndpoint <${SPARQL_ENDPOINT}> ; +# skosmos:sparqlEndpoint ; + skosmos:sparqlEndpoint <${SPARQL_ENDPOINT}> ; # use the dev.finto.fi endpoint where the example vocabularies reside # skosmos:sparqlEndpoint ; # sparql-query extension, or "Generic" for plain SPARQL 1.1 diff --git a/src/graphdb.py b/src/graphdb.py index 270b849..e525f86 100644 --- a/src/graphdb.py +++ b/src/graphdb.py @@ -9,6 +9,7 @@ from SPARQLWrapper import SPARQLWrapper, JSON, POST, DIGEST admin_password = os.environ.get("ADMIN_PASSWORD", '') +admin_username = os.environ.get("ADMIN_USERNAME", 'admin') endpoint = os.environ.get("SPARQL_ENDPOINT", '') @@ -29,7 +30,7 @@ def setup_graphdb() -> None: f"{endpoint}", headers=headers, data=fp, - auth=('admin', admin_password), + auth=(admin_username, admin_password), timeout=60 ) print(f"CREATED GRAPHDB[{endpoint}] DB[skosmos.tdb]") @@ -72,7 +73,7 @@ def set_timestamp(graph_name: str, timestamp: int) -> None: """ sparql = SPARQLWrapper(f"{endpoint}/statements") sparql.setHTTPAuth(DIGEST) - sparql.setCredentials("admin", admin_password) + sparql.setCredentials(admin_username, admin_password) sparql.setMethod(POST) q = """INSERT DATA {{ <{graph}> {timestamp} . @@ -92,7 +93,7 @@ def update_timestamp(graph_name: str, timestamp: int) -> None: """ sparql = SPARQLWrapper(f"{endpoint}/statements") sparql.setHTTPAuth(DIGEST) - sparql.setCredentials("admin", admin_password) + sparql.setCredentials(admin_username, admin_password) sparql.setMethod(POST) q = """ DELETE {{ @@ -139,7 +140,7 @@ def add_vocabulary(graph: TextIO, graph_name: str, extension: str) -> None: f"{endpoint}/statements", data=graph.read(), headers=headers, - auth=('admin', admin_password), + auth=(admin_username, admin_password), params={'context': f"<{graph_name}>"}, timeout=60, ) diff --git a/src/vocabularies.py b/src/vocabularies.py index 68de659..f45edbc 100644 --- a/src/vocabularies.py +++ b/src/vocabularies.py @@ -76,7 +76,7 @@ def get_graph(fp: IO) -> str: for line in fp: try: line = line.decode('utf-8') - except UnicodeDecodeError: + except (UnicodeDecodeError, AttributeError): # Already decoded pass if re.search("sparqlGraph", line):