1
0
mirror of https://github.com/ilri/dspace-statistics-api.git synced 2024-11-25 23:58:18 +01:00

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.
This commit is contained in:
Alan Orth 2018-09-18 15:34:25 +03:00
parent 1e16beed30
commit 4b4a959a1c
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
2 changed files with 5 additions and 3 deletions

View File

@ -13,7 +13,7 @@ Create a virtual environment and run it:
## Todo ## Todo
- Get variables from environment to make it easier to deploy from systemd - Take a list of items (POST in JSON?)
## License ## License
This work is licensed under the [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html). This work is licensed under the [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html).

6
app.py
View File

@ -3,10 +3,12 @@
# https://wiki.duraspace.org/display/DSPACE/Solr # https://wiki.duraspace.org/display/DSPACE/Solr
import falcon import falcon
import os
from SolrClient import SolrClient from SolrClient import SolrClient
solr_server = 'http://localhost:3000/solr' # Check if Solr connection information was provided in the environment
solr_core = 'statistics' solr_server = os.environ.get('SOLR_SERVER', 'http://localhost:8080/solr')
solr_core = os.environ.get('SOLR_CORE', 'statistics')
class ItemResource: class ItemResource:
def on_get(self, req, resp): def on_get(self, req, resp):