change default cookie path to /bitcoin/.cookie
This commit is contained in:
		
							parent
							
								
									e9386ec003
								
							
						
					
					
						commit
						dc491a5984
					
				@ -56,7 +56,7 @@ describe('Mempool Backend Config', () => {
 | 
				
			|||||||
        PASSWORD: 'mempool',
 | 
					        PASSWORD: 'mempool',
 | 
				
			||||||
        TIMEOUT: 60000,
 | 
					        TIMEOUT: 60000,
 | 
				
			||||||
        COOKIE: false,
 | 
					        COOKIE: false,
 | 
				
			||||||
        COOKIE_PATH: ''
 | 
					        COOKIE_PATH: '/bitcoin/.cookie'
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(config.SECOND_CORE_RPC).toStrictEqual({
 | 
					      expect(config.SECOND_CORE_RPC).toStrictEqual({
 | 
				
			||||||
@ -66,7 +66,7 @@ describe('Mempool Backend Config', () => {
 | 
				
			|||||||
        PASSWORD: 'mempool',
 | 
					        PASSWORD: 'mempool',
 | 
				
			||||||
        TIMEOUT: 60000,
 | 
					        TIMEOUT: 60000,
 | 
				
			||||||
        COOKIE: false,
 | 
					        COOKIE: false,
 | 
				
			||||||
        COOKIE_PATH: ''
 | 
					        COOKIE_PATH: '/bitcoin/.cookie'
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(config.DATABASE).toStrictEqual({
 | 
					      expect(config.DATABASE).toStrictEqual({
 | 
				
			||||||
 | 
				
			|||||||
@ -2,15 +2,13 @@ import config from '../../config';
 | 
				
			|||||||
const bitcoin = require('../../rpc-api/index');
 | 
					const bitcoin = require('../../rpc-api/index');
 | 
				
			||||||
import { BitcoinRpcCredentials } from './bitcoin-api-abstract-factory';
 | 
					import { BitcoinRpcCredentials } from './bitcoin-api-abstract-factory';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const defaultCookiePath = `${process.env.HOME}/.bitcoin/${{mainnet:'',testnet:'testnet3/',signet:'signet/'}[config.MEMPOOL.NETWORK]}.cookie`;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const nodeRpcCredentials: BitcoinRpcCredentials = {
 | 
					const nodeRpcCredentials: BitcoinRpcCredentials = {
 | 
				
			||||||
  host: config.CORE_RPC.HOST,
 | 
					  host: config.CORE_RPC.HOST,
 | 
				
			||||||
  port: config.CORE_RPC.PORT,
 | 
					  port: config.CORE_RPC.PORT,
 | 
				
			||||||
  user: config.CORE_RPC.USERNAME,
 | 
					  user: config.CORE_RPC.USERNAME,
 | 
				
			||||||
  pass: config.CORE_RPC.PASSWORD,
 | 
					  pass: config.CORE_RPC.PASSWORD,
 | 
				
			||||||
  timeout: config.CORE_RPC.TIMEOUT,
 | 
					  timeout: config.CORE_RPC.TIMEOUT,
 | 
				
			||||||
  cookie: config.CORE_RPC.COOKIE ? config.CORE_RPC.COOKIE_PATH || defaultCookiePath : undefined,
 | 
					  cookie: config.CORE_RPC.COOKIE ? config.CORE_RPC.COOKIE_PATH : undefined,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default new bitcoin.Client(nodeRpcCredentials);
 | 
					export default new bitcoin.Client(nodeRpcCredentials);
 | 
				
			||||||
 | 
				
			|||||||
@ -2,15 +2,13 @@ import config from '../../config';
 | 
				
			|||||||
const bitcoin = require('../../rpc-api/index');
 | 
					const bitcoin = require('../../rpc-api/index');
 | 
				
			||||||
import { BitcoinRpcCredentials } from './bitcoin-api-abstract-factory';
 | 
					import { BitcoinRpcCredentials } from './bitcoin-api-abstract-factory';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { defaultCookiePath } from './bitcoin-client';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const nodeRpcCredentials: BitcoinRpcCredentials = {
 | 
					const nodeRpcCredentials: BitcoinRpcCredentials = {
 | 
				
			||||||
  host: config.SECOND_CORE_RPC.HOST,
 | 
					  host: config.SECOND_CORE_RPC.HOST,
 | 
				
			||||||
  port: config.SECOND_CORE_RPC.PORT,
 | 
					  port: config.SECOND_CORE_RPC.PORT,
 | 
				
			||||||
  user: config.SECOND_CORE_RPC.USERNAME,
 | 
					  user: config.SECOND_CORE_RPC.USERNAME,
 | 
				
			||||||
  pass: config.SECOND_CORE_RPC.PASSWORD,
 | 
					  pass: config.SECOND_CORE_RPC.PASSWORD,
 | 
				
			||||||
  timeout: config.SECOND_CORE_RPC.TIMEOUT,
 | 
					  timeout: config.SECOND_CORE_RPC.TIMEOUT,
 | 
				
			||||||
  cookie: config.SECOND_CORE_RPC.COOKIE ? config.SECOND_CORE_RPC.COOKIE_PATH || defaultCookiePath : undefined,
 | 
					  cookie: config.SECOND_CORE_RPC.COOKIE ? config.SECOND_CORE_RPC.COOKIE_PATH : undefined,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default new bitcoin.Client(nodeRpcCredentials);
 | 
					export default new bitcoin.Client(nodeRpcCredentials);
 | 
				
			||||||
 | 
				
			|||||||
@ -185,7 +185,7 @@ const defaults: IConfig = {
 | 
				
			|||||||
    'PASSWORD': 'mempool',
 | 
					    'PASSWORD': 'mempool',
 | 
				
			||||||
    'TIMEOUT': 60000,
 | 
					    'TIMEOUT': 60000,
 | 
				
			||||||
    'COOKIE': false,
 | 
					    'COOKIE': false,
 | 
				
			||||||
    'COOKIE_PATH': '' // default value depends on network, see src/api/bitcoin/bitcoin-client
 | 
					    'COOKIE_PATH': '/bitcoin/.cookie'
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  'SECOND_CORE_RPC': {
 | 
					  'SECOND_CORE_RPC': {
 | 
				
			||||||
    'HOST': '127.0.0.1',
 | 
					    'HOST': '127.0.0.1',
 | 
				
			||||||
@ -194,7 +194,7 @@ const defaults: IConfig = {
 | 
				
			|||||||
    'PASSWORD': 'mempool',
 | 
					    'PASSWORD': 'mempool',
 | 
				
			||||||
    'TIMEOUT': 60000,
 | 
					    'TIMEOUT': 60000,
 | 
				
			||||||
    'COOKIE': false,
 | 
					    'COOKIE': false,
 | 
				
			||||||
    'COOKIE_PATH': ''
 | 
					    'COOKIE_PATH': '/bitcoin/.cookie'
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  'DATABASE': {
 | 
					  'DATABASE': {
 | 
				
			||||||
    'ENABLED': true,
 | 
					    'ENABLED': true,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user