From 4b4a959a1c61f7a8c0dd1fcb0f053b0ed8f10c24 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Tue, 18 Sep 2018 15:34:25 +0300 Subject: [PATCH] Add ability to get Solr parameters from environment You can use the SOLR_SERVER and SOLR_CORE variables to make deployment via systemd, etc easier. --- README.md | 2 +- app.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7cf61a0..648acf2 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Create a virtual environment and run it: ## Todo -- Get variables from environment to make it easier to deploy from systemd +- Take a list of items (POST in JSON?) ## License This work is licensed under the [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html). diff --git a/app.py b/app.py index 9134290..0f16fed 100644 --- a/app.py +++ b/app.py @@ -3,10 +3,12 @@ # https://wiki.duraspace.org/display/DSPACE/Solr import falcon +import os from SolrClient import SolrClient -solr_server = 'http://localhost:3000/solr' -solr_core = 'statistics' +# Check if Solr connection information was provided in the environment +solr_server = os.environ.get('SOLR_SERVER', 'http://localhost:8080/solr') +solr_core = os.environ.get('SOLR_CORE', 'statistics') class ItemResource: def on_get(self, req, resp):