Open somoza opened 1 year ago
You can use your cookie file out of the box!
Its easy, the only think what you do is to create an small script which you must load before your app starts.
Example:
set-env-vars.js:
import fs from 'fs';
const COOKIE_FILE_PATH = '/<PATH_TO_YOUR_COOKIE_FILE>/.cookie';
const content = fs.readFileSync(COOKIE_FILE_PATH, 'utf8');
const [user, pass] = content.split(':');
process.env.BITCOIN_RPC_USER = user;
process.env.BITCOIN_RPC_PASS = pass;
Load this script on the start of your application by adding import './set-env-vars.js';
Thats is it. You can test it with restart your bitcoin-node and comparing the .cookie files with the console.log output ;)
console.log(`${process.env.BITCOIN_RPC_USER} : ${process.env.BITCOIN_RPC_PASS}`);
Is there some way to add support for .cookie connection? I was not able to establish a connection.
Thanks!