mirror of
https://github.com/x86dev/docker-ttrss
synced 2025-12-13 09:56:02 +00:00
Implemented rolling release support:
- 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
This commit is contained in:
45
ttrss-utils.php
Normal file
45
ttrss-utils.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user