How to store specific options for node.js CLI tool?

I'm looking for a good practice there. I need to store some global config options in my node.js command-line tool.

For example typing in bash:

$: mycommand set myGlobalOption=value

and then I can use myGlobalOption with another commands, is storing this value in environment variable a good solution?

Store this in a configuration file in the user's home directory like ~/.myprog.json. You can't store persistent data in environment variables because those ultimately come from shell configuration files like ~/.bash_profile which are not machine editable. Allowing these values to be set by environment variables is reasonable, but just have the user set them herself and don't bother trying to have a set command like you describe.

You could also just take these options as command line arguments like mycommand --myglobaloption=value and let users who want to always use the same value set up a shell alias like alias mc="mycommand --myglobaloption=value".