Allow configuration with dotEnv/Environment variables
Description of the problem
- 12factor manifesto states that config should be stored in environment variables
- Secrets should not be in environment variables (risk of leaking in logs or to other applications)
- Libraries either allow or not to overload existing environment variables from the system
- A documentation is needed to allow people using apache modphp to have system environment variables as Apache environment variables if needed.
Expected benefits
- Easier configuration
Offered solution
- Use symfony/dotenv library
- Document secrets management (store in a file that only apache can read, provide the file path in an environment variable)
I see that it will be some interesting work to make the application unaware of what "environment" it is running in. I don't see that it is possible to address configuration variables according to this documentation https://symfony.com/doc/3.4/configuration.html but it is mentioned in the documentation for 4.3, 4.4 and 5.0.
Is this going to be an issue?
It's not going to be an issue, just a little more work 😄
Symfony < 4 was using two different entrypoint for http requests, app.php and app_dev.php, which defined whether you were in prod mod or dev mod. Since SF4, they moved the public folder to public rather than web, and changed both php files to a single public/index.php.
We can definitely quite easily change to that if needed.
Let me know if you want a PR for any of that.
@tdutrion Definitely interested in a PR for that
I will let you push and merge the upgrade to Symfony 4 if you don't mind, that will help me greatly as the changes I will have to do include Symfony\Component\ErrorHandler\Debug which is blocked by the current versions of other packages.
I have all the unit tests passing, and half the integration tests are failing with some weird error I do not understand but I will get that done in the next two weeks.
On Fri, Nov 29, 2019, at 8:48 PM, Thomas Dutrion wrote:
I will let you push and merge the upgrade to Symfony 4 https://twitter.com/grmpyprogrammer/status/1200524818686328833 if you don't mind, that will help me greatly as the changes I will have to do include
Symfony\Component\ErrorHandler\Debugwhich is blocked by the current versions of other packages.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/opencfp/opencfp/issues/1231?email_source=notifications&email_token=AAAG5IN2YF7IS3JQZGTIIYTQWHA7NA5CNFSM4JTDIYX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFPXG3Y#issuecomment-559903599, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAG5IKWTHS2YSDV5UE6ILLQWHA7NANCNFSM4JTDIYXQ.
Any chance to help you with that weird error at all?
Here's a sample of this error
SYMFONY_DEPRECATIONS_HELPER=disabled vendor/bin/phpunit --testsuite integration tests/Integration/Infrastructure/Event/AuthenticationListenerTest.php PHPUnit 7.5.17 by Sebastian Bergmann and contributors.
Runtime: PHP 7.3.10 with Xdebug 2.7.1 Configuration: /Users/chartjes/Sites/opencfp/phpunit.xml
Testing OpenCFP\Test\Integration\Infrastructure\Event\AuthenticationListenerTest EEEEEEEEE 9 / 9 (100%)
Time: 1.28 seconds, Memory: 80.00 MB
There were 9 errors:
- OpenCFP\Test\Integration\Infrastructure\Event\AuthenticationListenerTest::noLoginRequired TypeError: Argument 1 passed to Symfony\Component\Stopwatch\Stopwatch::stopSection() must be of the type string, null given, called in /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php on line 69
/Users/chartjes/Sites/opencfp/vendor/symfony/stopwatch/Stopwatch.php:84 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php:69 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:309 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:175 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:187 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:169 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:66 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Kernel.php:188 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Client.php:68 /Users/chartjes/Sites/opencfp/vendor/symfony/framework-bundle/Client.php:131 /Users/chartjes/Sites/opencfp/vendor/symfony/browser-kit/Client.php:404 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:113 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:120 /Users/chartjes/Sites/opencfp/tests/Integration/Infrastructure/Event/AuthenticationListenerTest.php:28
- OpenCFP\Test\Integration\Infrastructure\Event\AuthenticationListenerTest::talksRouteRequireLogin TypeError: Argument 1 passed to Symfony\Component\Stopwatch\Stopwatch::stopSection() must be of the type string, null given, called in /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php on line 69
/Users/chartjes/Sites/opencfp/vendor/symfony/stopwatch/Stopwatch.php:84 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php:69 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:309 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:175 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:187 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:128 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:66 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Kernel.php:188 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Client.php:68 /Users/chartjes/Sites/opencfp/vendor/symfony/framework-bundle/Client.php:131 /Users/chartjes/Sites/opencfp/vendor/symfony/browser-kit/Client.php:404 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:113 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:120 /Users/chartjes/Sites/opencfp/tests/Integration/Infrastructure/Event/AuthenticationListenerTest.php:38
- OpenCFP\Test\Integration\Infrastructure\Event\AuthenticationListenerTest::talksRouteWithLogin TypeError: Argument 1 passed to Symfony\Component\Stopwatch\Stopwatch::stopSection() must be of the type string, null given, called in /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php on line 69
/Users/chartjes/Sites/opencfp/vendor/symfony/stopwatch/Stopwatch.php:84 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php:69 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:309 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:175 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:187 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:169 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:66 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Kernel.php:188 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Client.php:68 /Users/chartjes/Sites/opencfp/vendor/symfony/framework-bundle/Client.php:131 /Users/chartjes/Sites/opencfp/vendor/symfony/browser-kit/Client.php:404 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:113 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:120 /Users/chartjes/Sites/opencfp/tests/Integration/Infrastructure/Event/AuthenticationListenerTest.php:63
- OpenCFP\Test\Integration\Infrastructure\Event\AuthenticationListenerTest::reviewerDashboardRequiresLogin TypeError: Argument 1 passed to Symfony\Component\Stopwatch\Stopwatch::stopSection() must be of the type string, null given, called in /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php on line 69
/Users/chartjes/Sites/opencfp/vendor/symfony/stopwatch/Stopwatch.php:84 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php:69 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:309 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:175 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:187 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:128 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:66 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Kernel.php:188 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Client.php:68 /Users/chartjes/Sites/opencfp/vendor/symfony/framework-bundle/Client.php:131 /Users/chartjes/Sites/opencfp/vendor/symfony/browser-kit/Client.php:404 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:113 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:120 /Users/chartjes/Sites/opencfp/tests/Integration/Infrastructure/Event/AuthenticationListenerTest.php:73
- OpenCFP\Test\Integration\Infrastructure\Event\AuthenticationListenerTest::reviewerDashboardRequiresReviewer TypeError: Argument 1 passed to Symfony\Component\Stopwatch\Stopwatch::stopSection() must be of the type string, null given, called in /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php on line 69
/Users/chartjes/Sites/opencfp/vendor/symfony/stopwatch/Stopwatch.php:84 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php:69 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:309 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:175 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:187 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:128 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:66 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Kernel.php:188 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Client.php:68 /Users/chartjes/Sites/opencfp/vendor/symfony/framework-bundle/Client.php:131 /Users/chartjes/Sites/opencfp/vendor/symfony/browser-kit/Client.php:404 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:113 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:120 /Users/chartjes/Sites/opencfp/tests/Integration/Infrastructure/Event/AuthenticationListenerTest.php:90
- OpenCFP\Test\Integration\Infrastructure\Event\AuthenticationListenerTest::reviewerDashboardAsReviewer TypeError: Argument 1 passed to Symfony\Component\Stopwatch\Stopwatch::stopSection() must be of the type string, null given, called in /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php on line 69
/Users/chartjes/Sites/opencfp/vendor/symfony/stopwatch/Stopwatch.php:84 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php:69 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:309 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:175 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:187 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:169 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:66 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Kernel.php:188 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Client.php:68 /Users/chartjes/Sites/opencfp/vendor/symfony/framework-bundle/Client.php:131 /Users/chartjes/Sites/opencfp/vendor/symfony/browser-kit/Client.php:404 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:113 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:120 /Users/chartjes/Sites/opencfp/tests/Integration/Infrastructure/Event/AuthenticationListenerTest.php:107
- OpenCFP\Test\Integration\Infrastructure\Event\AuthenticationListenerTest::adminDashboardRequiresLogin TypeError: Argument 1 passed to Symfony\Component\Stopwatch\Stopwatch::stopSection() must be of the type string, null given, called in /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php on line 69
/Users/chartjes/Sites/opencfp/vendor/symfony/stopwatch/Stopwatch.php:84 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php:69 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:309 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:175 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:187 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:128 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:66 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Kernel.php:188 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Client.php:68 /Users/chartjes/Sites/opencfp/vendor/symfony/framework-bundle/Client.php:131 /Users/chartjes/Sites/opencfp/vendor/symfony/browser-kit/Client.php:404 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:113 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:120 /Users/chartjes/Sites/opencfp/tests/Integration/Infrastructure/Event/AuthenticationListenerTest.php:117
- OpenCFP\Test\Integration\Infrastructure\Event\AuthenticationListenerTest::adminDashboardRequiresAdmin TypeError: Argument 1 passed to Symfony\Component\Stopwatch\Stopwatch::stopSection() must be of the type string, null given, called in /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php on line 69
/Users/chartjes/Sites/opencfp/vendor/symfony/stopwatch/Stopwatch.php:84 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php:69 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:309 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:175 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:187 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:128 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:66 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Kernel.php:188 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Client.php:68 /Users/chartjes/Sites/opencfp/vendor/symfony/framework-bundle/Client.php:131 /Users/chartjes/Sites/opencfp/vendor/symfony/browser-kit/Client.php:404 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:113 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:120 /Users/chartjes/Sites/opencfp/tests/Integration/Infrastructure/Event/AuthenticationListenerTest.php:134
- OpenCFP\Test\Integration\Infrastructure\Event\AuthenticationListenerTest::adminDashboardAsAdmin TypeError: Argument 1 passed to Symfony\Component\Stopwatch\Stopwatch::stopSection() must be of the type string, null given, called in /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php on line 69
/Users/chartjes/Sites/opencfp/vendor/symfony/stopwatch/Stopwatch.php:84 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php:69 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:309 /Users/chartjes/Sites/opencfp/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:175 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:187 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:169 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/HttpKernel.php:66 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Kernel.php:188 /Users/chartjes/Sites/opencfp/vendor/symfony/http-kernel/Client.php:68 /Users/chartjes/Sites/opencfp/vendor/symfony/framework-bundle/Client.php:131 /Users/chartjes/Sites/opencfp/vendor/symfony/browser-kit/Client.php:404 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:113 /Users/chartjes/Sites/opencfp/tests/Integration/WebTestCase.php:120 /Users/chartjes/Sites/opencfp/tests/Integration/Infrastructure/Event/AuthenticationListenerTest.php:151
ERRORS! Tests: 9, Assertions: 0, Errors: 9.