I am using node-gyp, and I would like to use the value of an environment variable inside my binding.gyp
file.
Here is the hard way (list context):
'<!@(printf "%s" "$FOO")'
But is there an easier way?
I am using node-gyp, and I would like to use the value of an environment variable inside my binding.gyp
file.
Here is the hard way (list context):
'<!@(printf "%s" "$FOO")'
But is there an easier way?
To the best of my knowledge from working with gyp (the parent Google's project, not the one that ships with node https://code.google.com/p/gyp/). You can access environment variables the same way you would have in the shell.
For example:
'$(FOO)'
Will return the data stored inside of FOO
.
To get that information in a list context, I don't know if there is a better way than what you did, except for perhaps a more concise way:
'<!(echo $FOO)'
You can find Google's gyp input format reference online here.