Merge pull request #49 from felixgilles/master
TinyTinyRSS now use env variables for config with prefix TTRSS_
This commit is contained in:
commit
f3d0667a43
@ -114,12 +114,12 @@ setup_ttrss()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Patch URL path.
|
# Patch URL path.
|
||||||
sed -i -e "s@define('SELF_URL_PATH'.*@define('SELF_URL_PATH', '$TTRSS_SELF_URL');@g" ${TTRSS_PATH}/config.php
|
echo "putenv('TTRSS_SELF_URL_PATH=$TTRSS_SELF_URL');" >> ${TTRSS_PATH}/config.php
|
||||||
|
|
||||||
# Check if single user mode is selected
|
# Check if single user mode is selected
|
||||||
if [ "$TTRSS_SINGLEUSER" = true ]; then
|
if [ "$TTRSS_SINGLEUSER" = true ]; then
|
||||||
echo "Single User mode Selected"
|
echo "Single User mode Selected"
|
||||||
sed -i -e "s/.*define('SINGLE_USER_MODE'.*/define('SINGLE_USER_MODE', 'true');/g" ${TTRSS_PATH}/config.php
|
echo "putenv('TTRSS_SINGLE_USER_MODE=1');" >> ${TTRSS_PATH}/config.php
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable additional system plugins.
|
# Enable additional system plugins.
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
include '/srv/ttrss-utils.php';
|
include '/srv/ttrss-utils.php';
|
||||||
|
|
||||||
$confpath = env('TTRSS_PATH', '/var/www/ttrss/');
|
$confpath = env('TTRSS_PATH', '/var/www/ttrss');
|
||||||
$conffile = $confpath . 'config.php';
|
$conffile = $confpath . '/config.php';
|
||||||
|
|
||||||
$ename = 'DB';
|
$ename = 'DB';
|
||||||
$eport = 5432;
|
$eport = 5432;
|
||||||
@ -73,7 +73,8 @@ try {
|
|||||||
}
|
}
|
||||||
catch (PDOException $e) {
|
catch (PDOException $e) {
|
||||||
echo 'Database table not found, applying schema... ' . PHP_EOL;
|
echo 'Database table not found, applying schema... ' . PHP_EOL;
|
||||||
$schema = file_get_contents($confpath . 'schema/ttrss_schema_' . $config['DB_TYPE'] . '.sql');
|
|
||||||
|
$schema = file_get_contents($confpath . '/schema/ttrss_schema_' . $config['DB_TYPE'] . '.sql');
|
||||||
$schema = preg_replace('/--(.*?);/', '', $schema);
|
$schema = preg_replace('/--(.*?);/', '', $schema);
|
||||||
$schema = preg_replace('/[\r\n]/', ' ', $schema);
|
$schema = preg_replace('/[\r\n]/', ' ', $schema);
|
||||||
$schema = trim($schema, ' ;');
|
$schema = trim($schema, ' ;');
|
||||||
@ -85,6 +86,6 @@ catch (PDOException $e) {
|
|||||||
|
|
||||||
$contents = file_get_contents($conffile);
|
$contents = file_get_contents($conffile);
|
||||||
foreach ($config as $name => $value) {
|
foreach ($config as $name => $value) {
|
||||||
$contents = preg_replace('/(define\s*\(\'' . $name . '\',\s*)(.*)(\);)/', '$1"' . $value . '"$3', $contents);
|
$contents .= "putenv('TTRSS_" . $name . "=" . $value . "');\n";
|
||||||
}
|
}
|
||||||
file_put_contents($conffile, $contents);
|
file_put_contents($conffile, $contents);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user