diff --git a/README.md b/README.md index cf1cca6..fa00be9 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,25 @@ # Search for compose ## General informations -This image is used in the local development environment. It provides a service that is used as standard in the Nginx proxy. -If you call a url where no service is stored, this service is used. +This image is used in the local development environment. It provides a service that is used as standard in the Nginx +proxy. + +If you call a URL where no service is stored, this service is used. It searches through all available containers and finds the matching container that contains the domain. The container can be started at the click of a button. + ## How to use it + +If your project was only stopped and not fully shut down, you can easily restart it by simply entering the project's URL +into your browser. This service will pop up, and with just one click on the start button, all containers +associated with the project will be launched. This eliminates the need to manually start the containers through the +console, saving you time and effort. + ### Where you can find it too -* github.com/andersudnsehr + +* github.com/andersundsehr * hub.docker.com Made by me, Itay ≽^•⩊•^≼ \ No newline at end of file diff --git a/src/generateNginxConfig.php b/src/generateNginxConfig.php index 58bb3a8..4516799 100644 --- a/src/generateNginxConfig.php +++ b/src/generateNginxConfig.php @@ -3,11 +3,14 @@ $certFiles = scandir($certsDir); $newConfig = ''; +echo PHP_EOL . "\033[32m" . "Certificates : " . "\033[0m" . PHP_EOL; foreach ($certFiles as $cert) { if ($cert == '.' || $cert == '..') continue; if (pathinfo($cert, PATHINFO_EXTENSION) !== 'crt') continue; if ($cert === 'default.crt') continue; $domain = pathinfo($cert, PATHINFO_FILENAME); + echo PHP_EOL . "\033[32m" . "- " . $domain . "\033[0m" . PHP_EOL; + $virtualHost = getenv('VIRTUAL_HOST') ?: throw new \Exception('env VIRTUAL_HOST is required'); $newConfig .= " server { server_name *.$domain; @@ -20,14 +23,14 @@ ssl_certificate /etc/nginx/certs/$domain.crt; ssl_certificate_key /etc/nginx/certs/$domain.key; location / { - proxy_pass http://searchforcompose.vm17.iveins.de; + proxy_pass http://$virtualHost; } } "; } $nginxConfFile = "/searchforcompose.conf"; -//nginx proxy nich restarten wenn nichts geändert wurde +//only restart nginx if the config file has changed $oldConfig = file_get_contents($nginxConfFile); if ($oldConfig === $newConfig) { echo PHP_EOL . "\033[32m" . "Nginx config file did not change" . "\033[0m" . PHP_EOL;