You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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.