This commit is contained in:
Andras Bacsai 2023-05-26 10:54:22 +02:00
parent 6e3cc9d1f9
commit 0e26731b75

View File

@ -61,19 +61,6 @@ public function submit()
$url = Url::fromString($this->settings->fqdn);
$host = $url->getHost();
$schema = $url->getScheme();
$middlewares = [];
$tls = [];
$entryPoints = [
0 => 'http',
];
if ($schema === 'https') {
$entryPoints[] = 'https';
$middlewares[] = 'redirect-to-https@docker';
$tls = [
'certresolver' => 'letsencrypt',
];
}
$traefik_dynamic_conf = [
'http' =>
[
@ -81,11 +68,8 @@ public function submit()
[
'coolify' =>
[
'entryPoints' => $entryPoints,
'service' => 'coolify',
'rule' => "Host(`{$host}`)",
'middlewares' => $middlewares,
'tls' => $tls,
],
],
'services' =>
@ -106,6 +90,22 @@ public function submit()
],
],
];
$traefik_dynamic_conf['http']['routers']['coolify']['entryPoints'] = [
0 => 'http',
];
if ($schema === 'https') {
$traefik_dynamic_conf['http']['routers']['coolify']['entryPoints'][] = 'https';
$traefik_dynamic_conf['http']['routers']['coolify']['tls'] = [
'certresolver' => 'letsencrypt',
];
$traefik_dynamic_conf['http']['routers']['coolify']['middlewares'] = [
0 => 'redirect-to-https@docker',
];
} else {
$traefik_dynamic_conf['http']['routers']['coolify']['entryPoints'] = [
0 => 'http',
];
}
$yaml = Yaml::dump($traefik_dynamic_conf);
if (config('app.env') == 'local') {
dump($yaml);