Skip to content
Snippets Groups Projects
Commit c4eabd0e authored by jurgenhaas's avatar jurgenhaas
Browse files

#8 Changing ownership of new files and directories to the user

parent c26943d7
No related branches found
No related tags found
1 merge request!4Merging develop into main
Pipeline #548946 passed
......@@ -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');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment