Skip to content

Commit 9dbae8f

Browse files
committed
Use a more sophisticated env var concatenating to autobuild the Dataverse base url in best case.
1 parent 60da48d commit 9dbae8f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

dvconfig.py.sample

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import os
22

3-
base_url = os.getenv('BASE_URL', 'http://localhost:8080')
3+
# Create the base_url from different parts (very usefull on K8s) or just
4+
# read completely from a single env var. Default to "http://localhost:8080"
5+
host = os.getenv('DATAVERSE_SERVICE_HOST', 'localhost')
6+
port = os.getenv('DATAVERSE_SERVICE_PORT_HTTP', '8080')
7+
proto = os.getenv('DATAVERSE_SERVICE_PORT_PROTO', 'http')
8+
subpath = os.getenv('DATAVERSE_SERVICE_SUBPATH', '')
9+
base_url = os.getenv('BASE_URL', proto+'://'+host+':'+port+subpath)
10+
411
api_token = os.getenv('API_TOKEN', '')
512

613
# sample data will be created in the following order

0 commit comments

Comments
 (0)