Enable prometheus collection if requested

This commit is contained in:
Daniil Gentili 2024-06-30 16:18:13 +02:00
parent 632da98a33
commit 6184b5fd65

View File

@ -3,6 +3,8 @@
use danog\MadelineProto\Logger;
use TelegramApiServer\EventObservers\LogObserver;
use function Amp\Socket\SocketAddress\fromString;
$settings = [
'server' => [
'address' => (string)getenv('SERVER_ADDRESS'),
@ -69,6 +71,10 @@ $settings = [
'passwords' => (array)json_decode((string)getenv('PASSWORDS'), true),
'bulk_interval' => (float)getenv('REQUESTS_BULK_INTERVAL')
],
'metrics' => [
'enable_prometheus_collection' => (bool)getenv("PROMETHEUS_BIND_TO"),
'bind_to' => getenv("PROMETHEUS_BIND_TO") ? fromString(getenv("PROMETHEUS_BIND_TO")) : null
]
];
if (empty($settings['telegram']['connection']['proxies']['\danog\MadelineProto\Stream\Proxy\SocksProxy'][0]['address'])) {