Set Balena CLI API URL through an environment variable

I am attempting to use the Balena CLI in a shell script to preload an image with the latest release, however I am unable to login to my openBalena instance because the CLI is attempting to use the regular Balena cloud API servers. Is there an environment variable I can set before running the CLI to point it to my own openBalena API URL before running balena login --token <mytoken>?

Yes, I believe the environment variable would be BALENARC_BALENA_URL:

export BALENARC_BALENA_URL="mydomain.com"
balena login --token <mytoken>

The openBalena getting started guide mentions an alternative: setting the URL in the ~/.balenarc.yml file (the guide actually uses the old “resin” name):

$ cat $HOME/.balenarc.yml
balenaUrl: 'mydomain.com'

Between the rc file and the env var, you should be able to get it working. Otherwise let us know!

That worked! Thanks, somebody should probably update the documentation to match.