Skip to content

Commit

Permalink
allow setting the farm dir via an environment variable
Browse files Browse the repository at this point in the history
This allows us to preconfigure the farmer plugin in the Docker
container.
  • Loading branch information
splitbrain committed Apr 16, 2024
1 parent 341a2d3 commit 700b563
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions DokuWikiFarmCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,17 +409,23 @@ protected function adjustCascade()
protected function loadConfig()
{
$ini = DOKU_INC . 'conf/farm.ini';
if (!file_exists($ini)) return;
$config = parse_ini_file($ini, true);
foreach (array_keys($this->config) as $section) {
if (isset($config[$section])) {
$this->config[$section] = array_merge(
$this->config[$section],
$config[$section]
);
if (file_exists($ini)) {
$config = parse_ini_file($ini, true);
foreach (array_keys($this->config) as $section) {
if (isset($config[$section])) {
$this->config[$section] = array_merge(
$this->config[$section],
$config[$section]
);
}
}
}

// farmdir setup can be done via environment
if($this->config['base']['farmdir'] === '' && isset($_ENV['DOKU_FARMDIR'])) {
$this->config['base']['farmdir'] = $_ENV['DOKU_FARMDIR'];
}

$this->config['base']['farmdir'] = trim($this->config['base']['farmdir']);
$this->config['base']['farmhost'] = strtolower(trim($this->config['base']['farmhost']));
}
Expand Down

0 comments on commit 700b563

Please sign in to comment.