Answer the question
In order to leave comments, you need to log in
How to use sensitive data in Node using Linux?
Hello.
How to use (pass to the application) various important data, keys, environment variables, etc. through the console? At the moment I am using the node.js dotenv library, but I know that you can generally do everything without a library, using bash.
I can't find any clear instructions on how to do this. I found a tutorial, it starts with the words open open .bash_profile
and it gives me an error, I don’t have such a file.
Answer the question
In order to leave comments, you need to log in
It is possible through json and curl. Prepare a json file and fire it with curl.
Variables are easy to pass - they must be marked for export.
export variable=value
Thus, this variable will be copied to all child processes (for example, to your node.js)
Changing the configuration file itself does not affect the current session - after the change, you either need to restart/reboot, or simply re-execute the file, for example:
source . bash_profile
Which file to store in depends on how you start processes.
.bashrc - if you log in via bash to the console
.profile - if you open a terminal via gui
.bash_profile - in both cases
But you can just add any variable to the file, relogin and check if it exists via
echo $variable
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question