4
0
mirror of https://github.com/AzuraCast/AzuraCast.git synced 2024-06-19 07:27:07 +00:00

Align environment variable defaults in uptime_wait with Environment.

This commit is contained in:
Buster "Silver Eagle" Neece 2021-01-24 11:35:34 -06:00
parent b615a72050
commit 4cf94c6420
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E

View File

@ -50,12 +50,14 @@ class UptimeWait
public function __construct() public function __construct()
{ {
$this->spinner = new Spinner([ $this->spinner = new Spinner(
'🖥️🎶-🎵-📻', [
'🖥️-🎶-🎵📻', '🖥️🎶-🎵-📻',
'🖥️🎵-🎶-📻', '🖥️-🎶-🎵📻',
'🖥️-🎵-🎶📻', '🖥️🎵-🎶-📻',
]); '🖥️-🎵-🎶📻',
]
);
$_ENV = getenv(); $_ENV = getenv();
@ -88,15 +90,17 @@ class UptimeWait
{ {
try { try {
$dbOptions = [ $dbOptions = [
'host' => $_ENV['MYSQL_HOST'] ?? 'mariadb', 'host' => $_ENV['MYSQL_HOST'] ?? 'mariadb',
'port' => $_ENV['MYSQL_PORT'] ?? 3306, 'port' => (int)($_ENV['MYSQL_PORT'] ?? 3306),
'dbname' => $_ENV['MYSQL_DATABASE'], 'dbname' => $_ENV['MYSQL_DATABASE'] ?? 'azuracast',
'user' => $_ENV['MYSQL_USER'], 'user' => $_ENV['MYSQL_USER'] ?? 'azuracast',
'password' => $_ENV['MYSQL_PASSWORD'], 'password' => $_ENV['MYSQL_PASSWORD'] ?? 'azur4c457',
]; ];
$dbh = new PDO('mysql:host=' . $dbOptions['host'] . ';dbname=' . $dbOptions['dbname'], $dbOptions['user'], $dsn = 'mysql:host=' . $dbOptions['host'] . ';port=' . $dbOptions['port']
$dbOptions['password']); . ';dbname=' . $dbOptions['dbname'];
$dbh = new PDO($dsn, $dbOptions['user'], $dbOptions['password']);
$dbh->exec('SELECT 1'); $dbh->exec('SELECT 1');
@ -112,10 +116,14 @@ class UptimeWait
protected function checkRedis(): bool protected function checkRedis(): bool
{ {
$redisHost = $_ENV['REDIS_HOST'] ?? 'redis';
$redisPort = (int)($_ENV['REDIS_PORT'] ?? 6379);
$redisDb = (int)($_ENV['REDIS_DB'] ?? 1);
try { try {
$redis = new Redis(); $redis = new Redis();
$redis->connect('redis', 6379, 15); $redis->connect($redisHost, $redisPort, 15);
$redis->select(1); $redis->select($redisDb);
$redis->ping(); $redis->ping();