- Now basing on image 'kdelfour/supervisor-docker'
- Cron script will check and update TT-RSS and all plugins on a daily basis automatically
- SSL/TLS encryption is off by default so that TT-RSS is running on port 80 by default now
- SSL/TLS can be enabled with setting "-e TTRSS_SSL_ENABLED=1"
- A lot of cleanups
46 lines
865 B
PHP
46 lines
865 B
PHP
<?php
|
|
|
|
function env($name, $default = null)
|
|
{
|
|
$v = getenv($name) ?: $default;
|
|
|
|
if ($v === null) {
|
|
error('The env ' . $name . ' does not exist');
|
|
}
|
|
|
|
return $v;
|
|
}
|
|
|
|
function error($text)
|
|
{
|
|
echo 'Error: ' . $text . PHP_EOL;
|
|
exit(1);
|
|
}
|
|
|
|
function dbconnect($config)
|
|
{
|
|
$map = array('host' => 'HOST', 'port' => 'PORT', 'dbname' => 'NAME', 'user' => 'USER', 'password' => 'PASS');
|
|
$dsn = $config['DB_TYPE'] . ':';
|
|
foreach ($map as $d => $h) {
|
|
if (isset($config['DB_' . $h])) {
|
|
$dsn .= $d . '=' . $config['DB_' . $h] . ';';
|
|
}
|
|
}
|
|
$pdo = new \PDO($dsn);
|
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
return $pdo;
|
|
}
|
|
|
|
function dbcheck($config)
|
|
{
|
|
try {
|
|
dbconnect($config);
|
|
return true;
|
|
}
|
|
catch (PDOException $e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
?>
|