diff --git a/Traefik.php b/Traefik.php index 8f72c44a9b494306fd668da01eb31ca378ed0ec3..4aadf38f8cfc8998c9a8a7d71a73a80eb4f2231d 100644 --- a/Traefik.php +++ b/Traefik.php @@ -104,19 +104,25 @@ class Traefik { $traefikConfigPath = $_SERVER['HOME'] . '/.traefik/configuration'; $traefikFile = $traefikPath . '/docker-compose.yml'; + $user = getenv('USER'); $fs = new Filesystem(); if (!$fs->exists($traefikPath)) { $fs->mkdir($traefikPath); + $fs->chown($traefikPath, $user, TRUE); } if (!$fs->exists($traefikCertPath)) { $fs->mkdir($traefikCertPath); + $fs->chown($traefikCertPath, $user, TRUE); } if (!$fs->exists($traefikConfigPath)) { $fs->mkdir($traefikConfigPath); + $fs->chown($traefikConfigPath, $user, TRUE); } $upd1 = $this->updateFile($traefikConfigPath . '/certificates.toml', $this->defaultCertificatesConfig()); $upd2 = $this->updateFile($traefikFile, Yaml::dump($this->defaultDockerCompose(), 9, 2)); if ($upd1 || $upd2) { + $fs->chown($traefikConfigPath . '/certifications.toml', $user, TRUE); + $fs->chown($traefikFile, $user, TRUE); $cwd = getcwd(); chdir($traefikPath); exec('docker network create traefik-public 2>/dev/null');