Hi guys.
Is it possible to – I realize it’s yaml kind of question but thought experts here should know – substitute params/vars with OS’ (bash) own, at build time?
Say…
host: /APPOW/log/${HOSTNAME}/discourse.test
I thought, expected this would work out-of-box but it did not, for me. Thanks.
AI-generated summary
lejeczek is inquiring about substituting environment variables from the OS (bash) into YAML at build time. Lilly shared a link to a related discussion, but lejeczek found it unhelpful.
pfaffman clarified that environment variables cannot be substituted into YAML at build time, only at launch time. lejeczek explained that this feature would be useful for scaling up and avoiding the need to modify YAML files for each environment or host.
pfaffman suggested an alternative approach using the launcher command and migrating the database, but lejeczek believes that substituting environment variables at build time would be a valuable enhancement for future launcher versions.
Thanks. No, unless I’ve gone blind, temporarily - possible - does not cover my question. Does it?
I’m talking about OS’ env vars, shell variables which in YAML would resolve the their values – again, set in host’s shell (does not exist in .yml)
No.
You can set them at launch time, but not build time.
What are you trying to accomplish that you think replacing ENV in yaml at build time will accomplish?
These little tweaks are little saviours when scalling up, if only a bit.
That example above should be most telling – with no need to “fix” it in the yaml each time I build in different env / different host.
I sroogled and I see examples which claim that such simple substitution should work for YAML, but I can not get it to work.
I don’t believe that launcher will replace those ENV variables. It’s possible to build an image and then launch the same image multiple times with different domain names. You can
./launcher start-cmd app
To see what ENV is needed to launch.
To do it with a host that hasn’t bootstrapped, you’ll need to migrate the database and precompile assets.
That’d surely be very nice enhancement to future launcher versions, if it did.