mirror of
https://github.com/envoyr/nginx-configurator.git
synced 2026-04-28 04:06:18 +00:00
update example
This commit is contained in:
35
bin/ngxconf
35
bin/ngxconf
@@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
namespace Envoyr\NginxConfigurator;
|
||||
|
||||
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
|
||||
// Called from local git clone.
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
} elseif (file_exists(__DIR__ . '/../../../autoload.php')) {
|
||||
// Called from your project's vendor dir.
|
||||
require __DIR__ . '/../../../autoload.php';
|
||||
} else {
|
||||
die(
|
||||
'You need to set up the project dependencies using the following commands:' . PHP_EOL .
|
||||
'curl -s http://getcomposer.org/installer | php' . PHP_EOL .
|
||||
'php composer.phar install' . PHP_EOL
|
||||
);
|
||||
}
|
||||
|
||||
use Envoyr\NginxConfigurator\Command\AddLocationCommand;
|
||||
use Envoyr\NginxConfigurator\Command\AddServerCommand;
|
||||
use Envoyr\NginxConfigurator\Command\AddUpstreamServerCommand;
|
||||
use Envoyr\NginxConfigurator\Command\RemoveLocationCommand;
|
||||
use Envoyr\NginxConfigurator\Command\RemoveServerCommand;
|
||||
use Envoyr\NginxConfigurator\Command\RemoveUpstreamServerCommand;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
|
||||
$app = new Application('ngxconf', '1.0.0');
|
||||
$app->add(new AddServerCommand());
|
||||
$app->add(new RemoveServerCommand());
|
||||
$app->add(new AddLocationCommand());
|
||||
$app->add(new RemoveLocationCommand());
|
||||
$app->add(new AddUpstreamServerCommand());
|
||||
$app->add(new RemoveUpstreamServerCommand());
|
||||
$app->run();
|
||||
@@ -49,6 +49,6 @@ $builder = new Builder();
|
||||
if (count($defaultServers) > 0) {
|
||||
/** @var Server $defaultServer */
|
||||
foreach ($defaultServers as $defaultServer) {
|
||||
$builder->appendServerNode($defaultServer);
|
||||
$builder->append($defaultServer);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user