59 lines
1.1 KiB
PHP
59 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace app\config;
|
|
|
|
/**
|
|
* ZLMediaKit 配置类
|
|
*/
|
|
class ZLMConfig
|
|
{
|
|
/**
|
|
* ZLM服务器主机地址
|
|
*/
|
|
public string $host {
|
|
get => $this->host;
|
|
}
|
|
|
|
/**
|
|
* ZLM服务器端口
|
|
*/
|
|
public int $port {
|
|
get => $this->port;
|
|
}
|
|
|
|
/**
|
|
* 请求协议 (http/https)
|
|
*/
|
|
public string $schema {
|
|
get => $this->schema;
|
|
}
|
|
|
|
/**
|
|
* ZLM API密钥
|
|
*/
|
|
public string $secret {
|
|
get => $this->secret;
|
|
}
|
|
|
|
/**
|
|
* 完整地址 host:port
|
|
*/
|
|
public string $address {
|
|
get => "{$this->host}:{$this->port}";
|
|
}
|
|
|
|
/**
|
|
* API基础URL
|
|
*/
|
|
public string $apiBaseUrl {
|
|
get => "{$this->schema}://{$this->host}:{$this->port}";
|
|
}
|
|
|
|
public function __construct()
|
|
{
|
|
$this->host = Config::getStringEnv('ZLM_HOST', '127.0.0.1');
|
|
$this->port = Config::getIntEnv('ZLM_PORT', 80);
|
|
$this->schema = Config::getStringEnv('ZLM_SCHEMA', 'http');
|
|
$this->secret = Config::getStringEnv('ZLM_SECRET', '');
|
|
}
|
|
} |