Node.js / Export configuration file -
i have following configuration file in /etc/sysconfig/myconf
:
export user=root export node_dir=/opt/mydir
i want use these setting in .js
file, located in /opt/myapplication
:
var userapp = //user in /etc/sysconfig/myconf file var dir = //node_dir in /etc/sysconfig/myconf file
is there way without open file , parse contents?
as understand export should give me option read in node.js, don't find how (in addition, when run export -p
, don't see these variables)
edit: search equal node.js's command source command in linux (the variables not environment variables)
if environment variables available when launch program, can use process.env
. https://nodejs.org/api/process.html#process_process_env
Comments
Post a Comment