-
-
Notifications
You must be signed in to change notification settings - Fork 637
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
Conflict with docker env_file parsing #243
Comments
In fact an .env file was in the project and the error come from this one. |
Having the same problem. @lalop Did you find a solution? Trying to figure out if this is a phpdotenv specific, or if it is all docker-compose? |
Not really |
Same issue happens to "dockerized" java command invocation upon passing external values to java cli via system property: Dockerfile:
Snippet from my docker-compose: ...
environment:
JAVA_OPTS: |
-server
-ea
-Xms64m
-Xmx128m
-Dfoo.property=My Property
... resulting with Error: Could not find or load main class Property |
I think this is not a problem, docker is infrastructure level, and application level is another that should even be in separate directory (repositories) docker through the volumes you can link your application although this in another directory, well I think I. |
No fix for this issue? This is quite annoying, as soon as the code uses load, it doesn't load the docker env variable (even if there is no .env file or it's an empty file). |
@Arvi89 it isn't a phpdotenv issue, it is a docker issue. AFAIK there is no solution yet: docker/compose#2854 |
I have the same problem, this seems to be a direct conflict between how Docker parses and phpdotenv parses. From the Docker docs: There is no special handling of quotation marks. This means that they are part of the VAL. Per phpdotenv: Unquoted values cannot contain whitespace This means there is no way for me to use variable with spaces in it (without having separate env files). My Docker image requires an environment variable (with whitespace) in order to run. If I use quotes, Docker reads it incorrectly. If I don't use quotes my PHP app blows up. |
Hello,
I'm working on an app using docker, my environment variables are stored in an env_file and loaded in the environment by docker.
I have variable that can contains space, if I don't escape it with quotes phpdotenv throw an exception. Since the variable is ever loaded I don't understand why phpdotenv want to validate it.
For exemple if I use a database's password with a space, I will add something like that in my env_file
The mysql container will create a user with this password but phpdotenv will throw an error because it expects to see quotes around
user pass
but if I add this quotes the mysql user will be created with quotes in is password.Note that, phpdotenv don't read the env_file, it gets the variables from environment.
The text was updated successfully, but these errors were encountered: