Skip to content
Pre-deploy environment variables

10 months ago

The docs for pre-deploy commands state:

They execute within your private network and have access to your application's environment variables.

I am assuming this means that they are available as shell variables, however running the following pre-deploy command results in failure, despite that variable being set in the "Variables" config section: /app/efbundle --version --connection "$ConnectionStrings__MyConnectionString"

Is this the intended usage of environment variables in this context?

Alternatively, is it possible to use interpolated variables like we would when setting the value of another variable, i.e. ${{Postgres.PGHOST}}, such that my pre-deploy command would then look like:

/app/efbundle --verbose --connection "Server=${{Postgres.PGHOST}} ..."

Cheers!

Solved

12 Replies

10 months ago

Well, my latter question is not the case:

1463590329704775904


10 months ago

${{Postgres.PGHOST}} is Railway specific syntax.


10 months ago

But when I reference the variable (presumably available in the shell), which is definitely set, I get a config error as if it's not seeing the variable.



10 months ago

(Which does exist!)


10 months ago

See the part about what to do when deploying from an image or Dockerfile:


10 months ago

Thanks, missing /bin/sh -c was the issue. Working now:

1463591964468445185


10 months ago

As a follow-up suggestion, perhaps have a little warning show up if the UI detects entry of "$BLAH" looking sequences?


10 months ago

They are supported as is, as long as you use Railpack.


10 months ago

My needs are too complex for magic 😛


10 months ago

lol


10 months ago

Anyhoo, thanks for the help! Can mark as solved. ^_^


Status changed to Solved brody • 10 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...