For that we will have to write the following code. Now we need to add our environment variables. You may not have the same text like mine there. You can read a bit more about the text editors here user ~ $ nano. bash_profile using your favorite editor like nano, vim, sublime text, atom etc. (You can read about useful terminal commands of mac here) user desktop $ cd To do that open the terminal on your Mac or Linux and cd to the home directory. To set password and secret keys in environment variable on Mac and Linux. Set Passwords and Secret Keys in Environment Variables on Mac/Linux Have a look at the code below:- # The wrong way Hard coding your username, passwords or secret keys in your code is wrong way and it exposes you to vulnerability. In this post we will learn how to save/hide the passwords, secret keys in environment variables for MacOS, Linux and Windows. Hence, the safest way is to do so is saving your secret keys/password in envirnoment variables. You surely do not want to hard code the password in your code and accidentaly push it to a remote repository. like the code for our post on how to send emails using python uses google/app password. If you are into python, there is a fair chance that you would have contributed to open-source or had your code snippets/projects on Github or BitBucket.Some time your code involves some important credentials like passwords or secret keys etc. Hide Passwords and Secret Keys in Environment Variables
0 Comments
Leave a Reply. |