Files
librenms-librenms/app/Models/AlertTransport.php
Tony Murray 04bb75f5f3 Alert transport cleanup, no_proxy support and other proxy cleanups (#14763)
* Add no_proxy and other proxy related settings
Set user agent on all http client requests
Unify http client usage

* Style fixes

* Remove useless use statements

* Correct variable, good job phpstan

* Add tests
fix https_proxy bug
add tcp:// to the config settings format

* style and lint fixes

* Remove guzzle from the direct dependencies

* Use built in Laravel testing functionality

* update baseline
2023-05-23 09:25:17 -05:00

33 lines
710 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use LibreNMS\Alert\Transport;
use LibreNMS\Alert\Transport\Dummy;
class AlertTransport extends Model
{
use HasFactory;
protected $primaryKey = 'transport_id';
public $timestamps = false;
protected $casts = [
'is_default' => 'boolean',
'transport_config' => 'array',
];
protected $fillable = ['transport_config'];
public function instance(): Transport
{
$class = Transport::getClass($this->transport_type);
if (class_exists($class)) {
return new $class($this);
}
return new Dummy;
}
}