move ElasticSearch credentials to dbconn.php
This commit is contained in:
parent
a0e250da57
commit
afe412107e
@ -86,16 +86,13 @@ $repost_cars = [];
|
|||||||
|
|
||||||
function elasticIndex($index, $payload)
|
function elasticIndex($index, $payload)
|
||||||
{
|
{
|
||||||
define("ELASTIC_USERNAME", "elastic");
|
|
||||||
define("ELASTIC_PASSWORD", "DFbC769Ln0weJL33mtMXGbpJOK4RCJfx");
|
|
||||||
|
|
||||||
$uid = implode("_", array_merge([ "date" => date("Ymd") ], array_intersect_key($payload, array_flip(['brand', 'model', 'modification']))));
|
$uid = implode("_", array_merge([ "date" => date("Ymd") ], array_intersect_key($payload, array_flip(['brand', 'model', 'modification']))));
|
||||||
print "uid = ".$uid." | ".$payload['status']."\n";
|
print "uid = ".$uid." | ".$payload['status']."\n";
|
||||||
$id = md5($uid);
|
$id = md5($uid);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, "https://els.quickcode.ru/".$index."/_doc/".$id."/");
|
curl_setopt($ch, CURLOPT_URL, ELASTICSEARCH_HOST.$index."/_doc/".$id."/");
|
||||||
curl_setopt($ch, CURLOPT_USERPWD, ELASTIC_USERNAME . ":" . ELASTIC_PASSWORD);
|
curl_setopt($ch, CURLOPT_USERPWD, ELASTICSEARCH_USERNAME . ":" . ELASTICSEARCH_PASSWORD);
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json' ]);
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json' ]);
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 2000);
|
curl_setopt($ch, CURLOPT_TIMEOUT, 2000);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user