Skip to content

Commit

Permalink
added read me how to use it, changed logic behind if
Browse files Browse the repository at this point in the history
  • Loading branch information
Itay Melo Krämer committed Sep 5, 2024
1 parent ac728ca commit 332cb38
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 ≽^•⩊•^≼
7 changes: 4 additions & 3 deletions src/generateNginxConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
$newConfig = '';
foreach ($certFiles as $cert) {
if ($cert == '.' || $cert == '..') continue;
if (pathinfo($cert, PATHINFO_EXTENSION) !== 'crt') continue;
if (pathinfo($cert, PATHINFO_EXTENSION) === 'crt') continue;
if ($cert === 'default.crt') continue;
$domain = pathinfo($cert, PATHINFO_FILENAME);
$virtualHost = getenv('VIRTUAL_HOST');
$newConfig .= "
server {
server_name *.$domain;
Expand All @@ -20,14 +21,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;
Expand Down

0 comments on commit 332cb38

Please sign in to comment.