Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions v0/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
13 changes: 8 additions & 5 deletions v1/total/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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" => "*:*",
Expand Down Expand Up @@ -84,3 +85,5 @@ function fetchJson(string $url, ?string $user = null, ?string $pass = null, int
'details' => $e->getMessage()
]);
}

//TO DO: RATE LIMITING & AUDIT LOGGING
Loading