Need to pass AWS secret (environment variable) from powershell to Native Javascript

64 views Asked by At

I have an environment variable in PowerShell $env.aws_password and this holds the aws password and I need to pass this environment variable to javascript.

I am running the javascript file using & '\path\to\ScriptRunner.exe' '\path\to\CognosGroupsExtract.js'

And in the Javscript file i am passing the environment variable var password = "process.env.aws_password"

server.logon("username",password)

I am getting reference error as process is not defined and cannot install node. I cannot install anything in javascript and i have to pass password through memory. Is there any way ?

1

There are 1 answers

2
Martin Iszac On

See: Pass Node.js environment variable with Windows PowerShell

process.env is specific to Node.js, you would need to pass the password through memory.

& '\path\to\ScriptRunner.exe' '\path\to\CognosGroupsExtract.js' $env:aws_password

Please try this and let me know if it helps.