diff --git a/v0/swagger.json b/v0/swagger.json index 12ff0427..fa7087ce 100644 --- a/v0/swagger.json +++ b/v0/swagger.json @@ -7,13 +7,10 @@ }, "servers": [ { - "url": "http://localhost:8081/api/v0" + "url": "http://localhost:8081/api/v1" }, { - "url": "http://zimbor.go.ro:8091/api/v0" - }, - { - "url": "http://ale23yfm.go.ro/api/v0" + "url": "http://zimbor.go.ro:8091/api/v1" } ], "paths": { diff --git a/v1/total/index.php b/v1/total/index.php index 08f6bda4..9d6b6716 100644 --- a/v1/total/index.php +++ b/v1/total/index.php @@ -5,9 +5,10 @@ require_once __DIR__ . '/../../util/loadEnv.php'; loadEnv(__DIR__ . '/../../api.env'); -$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); @@ -40,12 +41,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"); } - $jobBase = "http://$PROD_SERVER/solr/job/select"; - $companyBase = "http://$PROD_SERVER/solr/company/select"; + $jobBase = "$PROTOCOL://$SOLR_SERVER/solr/job/select"; + $companyBase = "$PROTOCOL://$SOLR_SERVER/solr/company/select"; $jobUrl = $jobBase . '?' . http_build_query([ "q" => "*:*", @@ -84,3 +85,5 @@ function fetchJson(string $url, ?string $user = null, ?string $pass = null, int 'details' => $e->getMessage() ]); } + +//TO DO: RATE LIMITING & AUDIT LOGGING \ No newline at end of file