This commit is contained in:
Andras Bacsai
2023-05-26 10:28:38 +02:00
parent 15af5e5b37
commit bb0554c727

View File

@@ -62,12 +62,16 @@ class Form extends Component
$host = $url->getHost(); $host = $url->getHost();
$schema = $url->getScheme(); $schema = $url->getScheme();
$middlewares = []; $middlewares = [];
$tls = [];
$entryPoints = [ $entryPoints = [
0 => 'http', 0 => 'http',
]; ];
if ($schema === 'https') { if ($schema === 'https') {
$entryPoints[] = 'https'; $entryPoints[] = 'https';
$middlewares[] = 'redirect-to-https@docker'; $middlewares[] = 'redirect-to-https@docker';
$tls = [
'certresolver' => 'letsencrypt',
];
} }
$traefik_dynamic_conf = [ $traefik_dynamic_conf = [
@@ -81,6 +85,7 @@ class Form extends Component
'service' => 'coolify', 'service' => 'coolify',
'rule' => "Host(`{$host}`)", 'rule' => "Host(`{$host}`)",
'middlewares' => $middlewares, 'middlewares' => $middlewares,
'tls' => $tls,
], ],
], ],
'services' => 'services' =>
@@ -102,6 +107,10 @@ class Form extends Component
], ],
]; ];
$yaml = Yaml::dump($traefik_dynamic_conf); $yaml = Yaml::dump($traefik_dynamic_conf);
if (config('app.env') == 'local') {
dump($yaml);
return;
}
$base64 = base64_encode($yaml); $base64 = base64_encode($yaml);
remote_process([ remote_process([
"mkdir -p $dynamic_config_path", "mkdir -p $dynamic_config_path",