Symfony 4 - automatically change the environment by IP
Symfony 4 - automatically change the environment by IP We have three development servers (dev1, dev2, stage) and one production server and some symfony projects. We would like to change the environment automatically. Currently my hack looks like this in 'public/index.php' use AppKernel; use SymfonyComponentDebugDebug; use SymfonyComponentDotenvDotenv; use SymfonyComponentHttpFoundationRequest; require __DIR__.'/../vendor/autoload.php'; //----------- hack start ------------ $_SERVER['APP_ENV'] = 'prod'; $_SERVER['APP_DEBUG'] = 0; $_SERVER['APP_SECRET'] = '67d829bf61dc5f87a73fd814e2c9f629'; $localIP = getHostByName(getHostName()); if ($localIP === '81.4.552.97') { $_SERVER['APP_ENV'] = 'dev1'; $_SERVER['APP_DEBUG'] = 1; $_SERVER['APP_SECRET'] = '67d829bf61dc5f87a73fd814e2c9f629'; } ... //----------- hack end ------------ // The check is to ensure we don't use .env in...