Skip to content

Commit 1d3eb83

Browse files
authored
Merge pull request #1 from andersundsehr/searchforcompose
Searchforcompose
2 parents 9236aa2 + 24c44b7 commit 1d3eb83

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

README.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
# Search for compose
22

33
## General informations
4-
This image is used in the local development environment. It provides a service that is used as standard in the Nginx proxy.
54

6-
If you call a url where no service is stored, this service is used.
5+
This image is used in the local development environment. It provides a service that is used as standard in the Nginx
6+
proxy.
7+
8+
If you call a URL where no service is stored, this service is used.
79

810
It searches through all available containers and finds the matching container that contains the domain.
911
The container can be started at the click of a button.
12+
1013
## How to use it
14+
15+
If your project was only stopped and not fully shut down, you can easily restart it by simply entering the project's URL
16+
into your browser. This service will pop up, and with just one click on the start button, all containers
17+
associated with the project will be launched. This eliminates the need to manually start the containers through the
18+
console, saving you time and effort.
19+
1120
### Where you can find it too
12-
* github.com/andersudnsehr
21+
22+
* github.com/andersundsehr
1323
* hub.docker.com
1424

1525
Made by me, Itay ≽^•⩊•^≼

src/generateNginxConfig.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
$certFiles = scandir($certsDir);
44

55
$newConfig = '';
6+
echo PHP_EOL . "\033[32m" . "Certificates : " . "\033[0m" . PHP_EOL;
67
foreach ($certFiles as $cert) {
78
if ($cert == '.' || $cert == '..') continue;
89
if (pathinfo($cert, PATHINFO_EXTENSION) !== 'crt') continue;
910
if ($cert === 'default.crt') continue;
1011
$domain = pathinfo($cert, PATHINFO_FILENAME);
12+
echo PHP_EOL . "\033[32m" . "- " . $domain . "\033[0m" . PHP_EOL;
13+
$virtualHost = getenv('VIRTUAL_HOST') ?: throw new \Exception('env VIRTUAL_HOST is required');
1114
$newConfig .= "
1215
server {
1316
server_name *.$domain;
@@ -20,14 +23,14 @@
2023
ssl_certificate /etc/nginx/certs/$domain.crt;
2124
ssl_certificate_key /etc/nginx/certs/$domain.key;
2225
location / {
23-
proxy_pass http://searchforcompose.vm17.iveins.de;
26+
proxy_pass http://$virtualHost;
2427
}
2528
}
2629
";
2730
}
2831

2932
$nginxConfFile = "/searchforcompose.conf";
30-
//nginx proxy nich restarten wenn nichts geändert wurde
33+
//only restart nginx if the config file has changed
3134
$oldConfig = file_get_contents($nginxConfFile);
3235
if ($oldConfig === $newConfig) {
3336
echo PHP_EOL . "\033[32m" . "Nginx config file did not change" . "\033[0m" . PHP_EOL;

0 commit comments

Comments
 (0)