mirror of
https://github.com/ilri/dspace-statistics-api.git
synced 2024-11-22 14:25:01 +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:
parent
1e16beed30
commit
4b4a959a1c
@ -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
6
app.py
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user