-
-
Notifications
You must be signed in to change notification settings - Fork 447
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
override_url breaks setup #1340
Comments
Description is all over the place. What's the issue? And why is title saying override_url breaks setup when in description you say you experience issue no matter the override_url value? |
sorry for the confusing report. i started writing, tried more stuff and continued writing. the thing that confused me is how my DATABASE_URL got taken as only the database name and the default host etc are used for the connection information. i suspected that #1290 would be to blame. however, after a nights sleep, i tried with doctrine-bundle 2.2.4 and it is not about this. looking closely at everything again, i noticed that aparently the way i set my env variable in docker with an env_file it keeps the quotes in the variable. (visible in the however, to help prevent others running into the same problem: i am confused as to why the quoted DATABASE_URL is taken as database name with the quotes removed. is that by design? https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/configuration.html#connecting-using-a-url does not mention that. wouldn't it make sense to either complain about the extra quotes or strip them so that the string is parsed correctly? btw, on my hunt for documentation, i stumbled over https://symfony.com/doc/current/reference/configuration/doctrine.html#doctrine-dbal-configuration which claims that the url overwrites the individual settings. since 2.3 when override_url is set, it is the opposite, right? if you confirm, i will do a pull request on the symfony doc to add explanation about override_url. |
We are likely to deprecate |
do you have any input on the quote handling of DATABASE_URL? i'd love to clarify that in the dbal documentation. if the generated $dsn would just have my bogus DATABASE_URL including the quotes, i'd say it is just something that doctrine does not handle. but the quotes got stripped at some point, but aparently too late, which i find confusing. |
@nicolas-grekas doc PR for status quo with DoctrineBundle 2.3: symfony/symfony-docs#15321 |
@dbu IIRC, the Docker handling of env files does not parse them using the Bash rules, so they don't support the same quoting that bash. Symfony DotEnv explicitly supports a format that is compatible with using the file as |
yeah, it seems so that Docker does put them literal. but it is confusing to me why the env variable (including quotes) something did take away the |
@dbu this thing might at least partially be PHP's Also, |
wow, that parse_url is not what i would have expected :-O okay, if we don't actively do something about it in the bundle i guess its fine to keep not doing. i thought we somehow actively remove the quotes but too late... lets leave as is and hope other people don't confuse docker env variable logic with bash logic like i did... |
i am struggling getting dbal to work in a docker container. i have
the config/packages/doctrine.yaml file has
i dump the $dsn at vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php and it is
mysql:host=localhost;dbname=pdo-mysql://user:pass@otherserver:3306/databasename;charset=utf8mb4;
i tried setting override_url to false, but that made no difference.
i first had just
mysql
, but then triedpdo-mysql
to see if it makes a difference. it made no difference.what is extra weird is that if i run the console and define DATABASE_URL again, it is picked up correctly:
$ DATABASE_URL="pdo-mysql://user:pass@otherserver:3306/databasename?serverVersion=5.7" bin/console doctrine:migrations:migrate
from the fact that the wrong connection dsn does mention my things, i know that the env variable is not simply unseen, but it gets mixed up with some defaults. any ideas?
The text was updated successfully, but these errors were encountered: