You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently ran into a problem because in my .env file I was setting a password, and that password happened to have a $ in it. eg: PASSWORD='pass$word'. Although I single quoted the string, the parser is still expanding the variable, when it shouldn't be.
The correct behaviour would be to expand the variable when the string is double quoted, and to not expand the variable when the string is single quoted.
I wrote some tests that reflect the proper behaviour but I'm having some difficulty writing a solution that passes all the other tests. Any help or pointers in the right direction would be appreciated. I'm happy to keep working on a solution myself but thought I would throw it out there in case this issue is known.
Here are the tests I wrote:
it 'expands variables in double quoted strings' do
expect(env("FOO=test\nBAR=\"quote $FOO\"")).to eql('FOO' => 'test', 'BAR' => 'quote test')
end
it 'does not expand variables in single quoted strings' do
expect(env("BAR='quote $FOO'")).to eql('BAR' => 'quote $FOO')
end
The text was updated successfully, but these errors were encountered:
I recently ran into a problem because in my .env file I was setting a password, and that password happened to have a $ in it. eg:
PASSWORD='pass$word'
. Although I single quoted the string, the parser is still expanding the variable, when it shouldn't be.The correct behaviour would be to expand the variable when the string is double quoted, and to not expand the variable when the string is single quoted.
I wrote some tests that reflect the proper behaviour but I'm having some difficulty writing a solution that passes all the other tests. Any help or pointers in the right direction would be appreciated. I'm happy to keep working on a solution myself but thought I would throw it out there in case this issue is known.
Here are the tests I wrote:
The text was updated successfully, but these errors were encountered: