diff --git a/v1/random/index.php b/v1/random/index.php index 3e3b536..71d7fcf 100644 --- a/v1/random/index.php +++ b/v1/random/index.php @@ -54,14 +54,15 @@ // ======= REQUIRED api.env VARIABLES ======= // This script expects the following variables in api.env: -// PROD_SERVER= (e.g., http://localhost:8983 or https://solr.example.com) +// SOLR_SERVER= (e.g., http://localhost:8983 or https://solr.example.com) // SOLR_USER= // SOLR_PASS= // ======================================= -$PROD_SERVER = trim(getenv('PROD_SERVER') ?: ''); +$SOLR_SERVER = trim(getenv('SOLR_SERVER') ?: ''); $SOLR_USER = trim(getenv('SOLR_USER') ?: ''); $SOLR_PASS = trim(getenv('SOLR_PASS') ?: ''); +$PROTOCOL = trim(getenv('PROTOCOL') ?: ''); if ($_SERVER['REQUEST_METHOD'] !== 'GET') { http_response_code(405); @@ -94,12 +95,12 @@ function fetchJson(string $url, ?string $user = null, ?string $pass = null, int } try { - if (!$PROD_SERVER) { - throw new Exception("PROD_SERVER not set"); + if (!$SOLR_SERVER) { + throw new Exception("SOLR_SERVER not set"); } $core = 'job'; - $base = "http://$PROD_SERVER/solr/$core/select"; + $base = "$PROTOCOL://$SOLR_SERVER/solr/$core/select"; $countUrl = $base . '?q=*:*&rows=0'; error_log("RANDOM COUNT URL: $countUrl");