How do I set up env variables in linode for a third party api key?
I have set up my Linode with a node.js express app. I am using a third party mail server Send Grid to send emails. How do I set up environment variables such as Api key in my linode.
For example in Heroku I would just input these in their GUI somewhere and I can access it through the app/script.
I would appreciate if you have a solution.
Thanks in advance.
While researching SendGrid I came across this nifty section in their documentation that includes an interactive/editable example for how you can configure these environment variables. You can find this below:
Essentially, you want to set the environment variable from within the Linode itself. You can do this by using SSH or Lish to access the Linode. You could then either assign an environment variable or create a configuration file. For what it's worth, SendGrid recommends that if you choose to use a config file that you should make sure that it is not stored in version control.
Here's an example from the SendGrid documentation that shows how to store your key in a variable named
From your Linode's command line you could use the following commands:
To then access the variable, you can use the convention provided by your coding language.
const apiKey = process.env.SENDGRID_API_KEY;
I hope this helps!