Reputation: 683
In parameters I have
some.pass: '%env(resolve:some_pass)%'
.env
some_pass=#v[b'<:)TY:-U8T>p[z&.4G@)uB$~z1N
And when I call
$container->getParameter('some.pass')
I just get an empty string or an error with another type of pass.
My guess is that it's beacause of symbols in password.
How can I escape string in .env file or so?
Upvotes: 3
Views: 4666
Reputation: 468
Problem is with your first character #
that is used for comments in .env
files.
So when you setup in .env
file
parameter=#123
that will be resolved like empty string ""
cause first character is #
and everything after #
will be consider as comment.
Way to put #
in your parameter is to surround parameter value with double quotes.
parameter="#123"
will be resolved to string #123
.
Additional if you also want to add "
in parameter you can with escaping character using \
.
parameter="#12\"3"
will be resolved to string #12"3
Upvotes: 8