Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuration with dotEnv/Environment variables #1231

Open
tdutrion opened this issue Nov 29, 2019 · 7 comments
Open

Allow configuration with dotEnv/Environment variables #1231

tdutrion opened this issue Nov 29, 2019 · 7 comments

Comments

@tdutrion
Copy link
Contributor

Description of the problem

  1. 12factor manifesto states that config should be stored in environment variables
  2. Secrets should not be in environment variables (risk of leaking in logs or to other applications)
  3. Libraries either allow or not to overload existing environment variables from the system
  4. 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)
@chartjes
Copy link
Contributor

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?

@tdutrion
Copy link
Contributor Author

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.

@chartjes
Copy link
Contributor

@tdutrion Definitely interested in a PR for that

@tdutrion
Copy link
Contributor Author

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.

@chartjes
Copy link
Contributor

chartjes commented Nov 30, 2019 via email

@tdutrion
Copy link
Contributor Author

Any chance to help you with that weird error at all?

@chartjes
Copy link
Contributor

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:

  1. 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

  1. 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

  1. 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

  1. 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

  1. 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

  1. 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

  1. 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

  1. 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

  1. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants