4

I would like to store my Bitcoin RPC passwords and usernames in environment variables, like:

rpcuser=$RPC_USER
rpcpassword=$RPC_PASSWORD

Is this supported in bitcoin core? Can environmental variables be parsed from my bitcoin.conf file?

Mark S.
  • 2,680
  • 14
  • 23
alfetopito
  • 143
  • 4
  • Very bad idea! Why should you do such a thing? – o0'. May 24 '13 at 17:47
  • Why is it a bad idea? – alfetopito May 24 '13 at 17:52
  • I don't think this is a bad idea, but I *do* think that this is an [XY Problem](http://xyproblem.info/). – Nick ODell Jan 13 '16 at 23:27
  • This would be great to have. I use docker to host my bitcoin node and I would like to be able to have docker inject environment variables depending on production/dev etc. Have you found how to do this yet? – Mr_E Mar 19 '17 at 20:29
  • It's been awhile. At the time, I ended up generating the config file with the values rather than using envvars, as I found no other way to do it. – alfetopito Apr 17 '17 at 18:10

1 Answers1

3

No, bitcoin core does not expand environment variables in bitcoin.conf.

See here to see how options are parsed.

You can expand environment variables as arguments for bitcoind:

$ bitcoind -rpcuser="$RPC_USERNAME" -rpcpassword="$RPC_PASSWORD"
ohmyfromage
  • 139
  • 6