I am on debian 13 and i looked inside the /.n8n folder and there is a config file with an encryption key in it but there is nothing else. This is very frustrating.
I see mentions of an “export” function but i have no idea what it does or where it writes the file to.
Can someome please explain where is this infamous .env file or how to create it / place it?
thanks so much.
Hi @Nicolas_Zein Welcome!
the env files does not get created automatically, although compose.yml is something you might get, but for now you can just create that file by nano .env as currently the file you got stores keys and other stuff, just create your .env file and address it in your compose file like:
env_file:
- .env
just create your file next to your compose file, and everything should work fine after a restart. For the export you saw it does let you backup your flows & credentials, for example if you want to export your credentials you can do it with:
n8n export:credentials --all --decrypted --output=backups/decrypted.json
Thank you so much @Anshul_Namdev but i did create an .env inside /.n8n and it did nothing after a restart. Also i do not have a compose.yml file anywhere.
all i have is a config file with no extension inside that same /.n8n/ folder.
@Nicolas_Zein understood! You running n8n on npm, that is why! whatever you want to keep as your env variable just add those before running n8n in the same shell like:
export N8N_HOST=your-host
export N8N_PORT=5678
export N8N_PROTOCOL=http
n8n start
or for more persistent feel, consider this:
echo 'export N8N_HOST=your-host' >> ~/.bashrc
echo 'export N8N_PORT=5678' >> ~/.bashrc
source ~/.bashrc
n8n start
although you do not need to edit the encryption file n8n handles that so it is good to not do it until you explicitly want something else.
(If you actually have to work a lot with these env variables having a docker instance is a better take, it may look techy but once you get used to it, its easy.)
I am completely lost @Anshul_Namdev would you consider consulting for an hour and helping me with this? Here is my email nicolaszein@gmail.com thank you so much for your help thus far.
Hello Benjamin,
I don’t see where i would type “export”. n8n is running as a systemctl process. I am not using docker for n8n. I do not get what Ansul and you are kindly telling me to do and there is no clear dock anywhere….