Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu
FROM ubuntu:14.04
MAINTAINER Christian Lück <christian@lueck.tv>

RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ For more information check out the [official documentation](https://github.com/g
-e SELF_URL_PATH=https://example.org/ttrss
```

### Additional configuration

In addition to the environement variables above, it is possible to override any value in the `config.php`
by using another environment variable. Prefix the config value you want to override with `CONFIG_`
and it will replace the default value on container creation.

For example, to add the `auth_external` plugin, set the following variable:

```
-e CONFIG_PLUGINS='auth_internal, note, auth_external'
```

### Testing ttrss in foreground

For testing purposes it's recommended to initially start this container in foreground.
Expand Down
17 changes: 13 additions & 4 deletions configure-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
$super['DB_NAME'] = null;
$super['DB_USER'] = env('DB_ENV_USER', 'docker');
$super['DB_PASS'] = env('DB_ENV_PASS', $super['DB_USER']);

$pdo = dbconnect($super);

if ($super['DB_TYPE'] === 'mysql') {
Expand All @@ -75,7 +75,7 @@
}

unset($pdo);

if (dbcheck($config)) {
echo 'Database login created and confirmed' . PHP_EOL;
} else {
Expand All @@ -100,6 +100,15 @@
unset($pdo);
}

$config_prefix = 'CONFIG_';
foreach ($_SERVER as $name => $value) {
if (strpos($name, $config_prefix) === 0) {
$name = substr($name, strlen($config_prefix));
echo 'Getting config from env: ' . $name . PHP_EOL;
$config[$name] = $value;
}
}

$contents = file_get_contents($confpath);
foreach ($config as $name => $value) {
$contents = preg_replace('/(define\s*\(\'' . $name . '\',\s*)(.*)(\);)/', '$1"' . $value . '"$3', $contents);
Expand All @@ -109,11 +118,11 @@
function env($name, $default = null)
{
$v = getenv($name) ?: $default;

if ($v === null) {
error('The env ' . $name . ' does not exist');
}

return $v;
}

Expand Down