I have the following lines in my bitbucket-pipelines.yml inside a step:
- printf "$conf['reverse_proxy'] = true;\n" >> settings.php
- printf "$conf['reverse_proxy_addresses'] = array($_SERVER['REMOTE_ADDR']);\n" >> settings.php
which should append the two lines of text into the settings.php file. Neither of the two $conf or $_SERVER are variables defined in my repository or deployment, but when I check the content of the file they are being removed and all i'm left with is:
['reverse_proxy'] = true;
['reverse_proxy_addresses'] = array(['REMOTE_ADDR']);
at the bottom of the file. I have tried everything I can think of to escape the $ and i've tried echo instead of printf in case it was some weird edge case. I've also tried running the commands directly in a bash terminal and they output exactly what i'd expect.
In case it's relevant, i'm using the atlassian/default-image:3 image for the pipeline
Welcome to the community.
I do believe this is possible using echo command, you'll just need to produce those literal $ signs outside the double quotes.
You can use the below commands instead:
- echo '$conf'"['reverse_proxy'] = true;\n" >> settings.php - echo '$conf'"['reverse_proxy_addresses'] = array("'$_SERVER'"['REMOTE_ADDR']);\n" >> settings.php
Hope it helps and let me know how it goes.
Regards,
Mark C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.