backend: Add config file env var
This commit is contained in:
		
							parent
							
								
									9047cb5998
								
							
						
					
					
						commit
						8f0fc3af57
					
				@ -110,6 +110,11 @@ Run the Mempool backend:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
npm run start
 | 
					npm run start
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					You can also set env var `MEMPOOL_CONFIG_FILE` to specify a custom config file location:
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					MEMPOOL_CONFIG_FILE=/path/to/mempool-config.json npm run start
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
When it's running, you should see output like this:
 | 
					When it's running, you should see output like this:
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,6 @@
 | 
				
			|||||||
const configFile = require('../mempool-config.json');
 | 
					const configFromFile = require(
 | 
				
			||||||
 | 
					    process.env.MEMPOOL_CONFIG_FILE ? process.env.MEMPOOL_CONFIG_FILE : '../mempool-config.json'
 | 
				
			||||||
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface IConfig {
 | 
					interface IConfig {
 | 
				
			||||||
  MEMPOOL: {
 | 
					  MEMPOOL: {
 | 
				
			||||||
@ -249,7 +251,7 @@ class Config implements IConfig {
 | 
				
			|||||||
  MAXMIND: IConfig['MAXMIND'];
 | 
					  MAXMIND: IConfig['MAXMIND'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor() {
 | 
					  constructor() {
 | 
				
			||||||
    const configs = this.merge(configFile, defaults);
 | 
					    const configs = this.merge(configFromFile, defaults);
 | 
				
			||||||
    this.MEMPOOL = configs.MEMPOOL;
 | 
					    this.MEMPOOL = configs.MEMPOOL;
 | 
				
			||||||
    this.ESPLORA = configs.ESPLORA;
 | 
					    this.ESPLORA = configs.ESPLORA;
 | 
				
			||||||
    this.ELECTRUM = configs.ELECTRUM;
 | 
					    this.ELECTRUM = configs.ELECTRUM;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user