adt / configurator
Extended nette/configurator
Requires
- ext-ctype: *
- josegonzalez/dotenv: ^4.0
- nette/bootstrap: ^3.2
- tracy/tracy: ^2.9
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-master
- v6.2.0
- v6.1.1
- v6.1.0
- v6.0.3
- v6.0.2
- v6.0.1
- v6.0
- v5.4.1
- v5.4
- 5.3.4
- v5.3.3
- v5.3.2
- v5.3.1
- v5.3
- v5.2.1
- v5.2
- v5.1.1
- v5.1
- v5.0.4
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0
- v4.3
- v4.2
- v4.1.1
- v4.1
- v4.0.1
- v4.0
- v3.0.1
- v3.0
- v2.2
- v2.1
- v2.0
- v1.3
- v1.2.2
- v1.2.1
- v1.2
- v1.1
- v1.0
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4
- v0.3
- v0.2
- v0.1
- dev-loadEnv-fix-order
- dev-app-debug
- dev-f-allows-to-have-numeric-string-with-zero-on-start-as-string
- dev-improvements
This package is auto-updated.
Last update: 2026-11-08 13:13:19 UTC
README
Extended nette/configurator.
Installation
composer require adt/configurator
Usage
$configurator = new Configurator();
$configurator->loadEnv(__DIR__ . '/..', ['.env.common']);
// Uncomment line below to create hash for new developer.
// ADT\Configurator::newDeveloper('JohnDoe');
$configurator
->addDeveloper(json_decode($_ENV['NETTE_DEVELOPERS'], true))
->setDebugMode((bool) $_ENV['NETTE_DEBUG']);
$configurator
->setConfigDirectory(__DIR__ . '/config')
->addConfig('common')
->addConfig('interface/' . php_sapi_name())
->addConfig('stage/' . $_ENV['STAGE'])
->addConfig(explode(',', $_ENV['NETTE_ENV']))
->addConfig(Configurator::isCli() && Configurator::get('country') ? 'cli-country' : null)
->addConfig(Configurator::get('country') ? 'env/' . $_ENV['STAGE'] . '-' . Configurator::get('country') : null)
->addConfig($_ENV['NETTE_TEST'] ? 'test' : null);
Maintenance window
The recipe of adt/docker-deployer runs pending
migrations in a maintenance window: it creates ~/project/maintenance on all servers, so that
the application holds no metadata locks of the tables being changed (DDL on a Galera cluster
conflicts with them). Handle it right after loadEnv(), before the DI container is created:
$configurator->loadEnv(__DIR__ . '/..'); $configurator->handleMaintenance();
- web:
503withRetry-After, a default page or your own (handleMaintenance($template)) - console: ends with exit code 0 (cron jobs skip a run), except the waiting commands
(default
['background-queue:consume'], second argument), which wait until the maintenance ends - supervisor would restart a consumer that exits in a loop
.env of the project:
# inside the containers; the deploy root ~/project is mounted at /var/www/html
MAINTENANCE_FILE=/var/www/html/maintenance
# commands of the deploy get 1 and skip the check; it must be listed (empty),
# otherwise `de` does not pass it into the container
MAINTENANCE_BYPASS=
Configurator::isMaintenance() tells whether the maintenance is on.
Tracy bar with concurrent AJAX requests
In debug mode enableTracy() stores the deferred Tracy bar content in ADT\Tracy\LockFreeFileSession
instead of Tracy's FileSession. FileSession keeps the file of the tracy-session cookie
locked for the whole request, so concurrent AJAX requests of one browser (a page firing several
signals at once) run one after another. LockFreeFileSession locks the file only while reading
and writing and merges the changes of concurrent requests. A storage set by the project before
enableTracy() (Debugger::setSessionStorage()) is kept.
Tests
composer install
composer test