wrapper 2.4, changed PROXY config, docker php82

This commit is contained in:
Pablo Ferreiro 2023-09-27 13:24:27 +02:00
parent 9d9207b05e
commit 7c333b1658
7 changed files with 623 additions and 76 deletions

View file

@ -6,8 +6,8 @@ use TikScraper\Models\Meta;
class ErrorHandler {
public static function showMeta(Meta $meta) {
http_response_code($meta->http_code);
Wrappers::latte('error', new ErrorTemplate($meta->http_code, $meta->tiktok_msg, $meta->tiktok_code));
http_response_code($meta->httpCode);
Wrappers::latte('error', new ErrorTemplate($meta->httpCode, $meta->proxitokMsg, $meta->proxitokCode));
}
public static function showText(int $code, string $msg) {

View file

@ -149,16 +149,10 @@ class Wrappers {
];
// -- PROXY CONFIG -- //
$proxy_host = Misc::env('PROXY_HOST', '');
$proxy_port = Misc::env('PROXY_PORT', '');
$proxy = Misc::env('PROXY', '');
if ($proxy_host && $proxy_port) {
$options['proxy'] = [
'host' => $proxy_host,
'port' => $proxy_port,
'username' => Misc::env('PROXY_USERNAME', null),
'password' => Misc::env('PROXY_PASSWORD', null)
];
if ($proxy !== '') {
$options['proxy'] = $proxy;
}
// Cache config
@ -183,7 +177,7 @@ class Wrappers {
$password = $url['pass'] ?? null;
} else {
$host = $_ENV['REDIS_HOST'];
$port = (int) $_ENV['REDIS_PORT'];
$port = intval($_ENV['REDIS_PORT']);
$password = isset($_ENV['REDIS_PASSWORD']) ? $_ENV['REDIS_PASSWORD'] : null;
}
$cacheEngine = new RedisCache($host, $port, $password);