Environment Variables in n8n (Docker image)

is there a way to handle both credentials and urls as environment variables and embed them in HTTP node in n8n?
I thought of adding them in docker-compose file. it worked for URLs but not for credentials.

Hi @mohamedelnady-406 what i would say is that you should try {{ $env.MY_VAR }} expressions in your HTTP node fields for url only, and just to clarify for credentials env variables are not directly injectable , for that just use a custom auth credentials so that would store all of your related values to be sent in a safe place and would not reveal those. I mostly use custom Auth as it is pretty much one time setup thing.

1 Like

I face a problem when i copy a workflow and paste it in some other page, the authentication creds in each HTTP node is set to the first credential i have defined in credentials tab. not the ones i specified earlier before copying and paste. do you have any idea about that?

1 Like

@mohamedelnady-406 i understand you i have faced the same thing, i just export workflow as JSON and import those, sounds like a pain but really works all the time, just select the credentials you wanna use and thats it

1 Like