diff --git a/root/srv/setup-ttrss.sh b/root/srv/setup-ttrss.sh index ad2d77c..e98a144 100755 --- a/root/srv/setup-ttrss.sh +++ b/root/srv/setup-ttrss.sh @@ -114,12 +114,12 @@ setup_ttrss() fi # 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 if [ "$TTRSS_SINGLEUSER" = true ]; then 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 # Enable additional system plugins. diff --git a/root/srv/ttrss-configure-db.php b/root/srv/ttrss-configure-db.php index 73895c7..062ec1d 100644 --- a/root/srv/ttrss-configure-db.php +++ b/root/srv/ttrss-configure-db.php @@ -3,8 +3,8 @@ include '/srv/ttrss-utils.php'; -$confpath = env('TTRSS_PATH', '/var/www/ttrss/'); -$conffile = $confpath . 'config.php'; +$confpath = env('TTRSS_PATH', '/var/www/ttrss'); +$conffile = $confpath . '/config.php'; $ename = 'DB'; $eport = 5432; @@ -73,7 +73,8 @@ try { } catch (PDOException $e) { 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('/[\r\n]/', ' ', $schema); $schema = trim($schema, ' ;'); @@ -85,6 +86,6 @@ catch (PDOException $e) { $contents = file_get_contents($conffile); 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);