Pre-deploy environment variables

2 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

2 months ago

Well, my latter question is not the case:

1463590329704776000


2 months ago

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


2 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.


2 months ago

1463590483380146200


2 months ago

(Which does exist!)


2 months ago

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


2 months ago

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

1463591964468445200


2 months ago

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


2 months ago

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


2 months ago

My needs are too complex for magic 😛


2 months ago

lol


2 months ago

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


Status changed to Solved brody about 2 months ago


Loading...