mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-21 16:52:00 -07:00
200 lines
7.5 KiB
JavaScript
200 lines
7.5 KiB
JavaScript
/*
|
|
This file is used to store unsecure, application-specific data common to all
|
|
environments.
|
|
|
|
Additional Environent Variables:
|
|
- CONNECT_PREF: should have a value of 'cr' (default), or 'direct'. This is
|
|
used by helia-coord to select a connection preference between peers. Servers
|
|
with an ip4 or ip6 address should use 'direct'.
|
|
*/
|
|
|
|
/* eslint no-unneeded-ternary:0 */
|
|
|
|
// Hack to get __dirname back.
|
|
// https://blog.logrocket.com/alternatives-dirname-node-js-es-modules/
|
|
import * as url from 'url'
|
|
|
|
// Get the version from the package.json file.
|
|
import { readFileSync } from 'fs'
|
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
|
const pkgInfo = JSON.parse(readFileSync(`${__dirname.toString()}/../../package.json`))
|
|
|
|
const version = pkgInfo.version
|
|
|
|
const ipfsCoordName = process.env.COORD_NAME
|
|
? process.env.COORD_NAME
|
|
: 'ipfs-torlist-service-generic'
|
|
|
|
export default {
|
|
// Configure TCP port.
|
|
port: process.env.PORT || 5700,
|
|
|
|
// Password for HTML UI that displays logs.
|
|
logPass: 'test',
|
|
|
|
// Email server settings if nodemailer email notifications are used.
|
|
emailServer: process.env.EMAILSERVER
|
|
? process.env.EMAILSERVER
|
|
: 'mail.someserver.com',
|
|
emailUser: process.env.EMAILUSER
|
|
? process.env.EMAILUSER
|
|
: 'noreply@someserver.com',
|
|
emailPassword: process.env.EMAILPASS
|
|
? process.env.EMAILPASS
|
|
: 'emailpassword',
|
|
|
|
// PSF Web 3 community infrastructure
|
|
useFullStackCash: process.env.USE_FULLSTACKCASH ? true : false,
|
|
consumerUrl: process.env.CONSUMER_URL
|
|
? process.env.CONSUMER_URL
|
|
// : 'https://free-bch.fullstack.cash',
|
|
: 'https://dev-consumer.psfoundation.info',
|
|
// : 'https://wa-usa-bch-consumer.fullstackcash.nl',
|
|
|
|
// P2WDB URL that will accept API calls from the p2wdb npm library.
|
|
p2wdbUrl: process.env.P2WDB_URL ? process.env.P2WDB_URL : 'https://p2wdb.fullstack.cash',
|
|
// p2wdbUrl: process.env.P2WDB_URL ? process.env.P2WDB_URL : 'http://localhost:5010',
|
|
|
|
// Enable or Disable the usage of Mongo DB.
|
|
noMongo: process.env.NO_MONGO ? true : false,
|
|
|
|
// BEGIN WALLET CONFIGURATION
|
|
|
|
// BCH Mnemonic for generating encryption keys and payment address
|
|
mnemonic: process.env.MNEMONIC ? process.env.MNEMONIC : '',
|
|
|
|
// (Optional) use a wallet file generated by psf-bch-wallet.
|
|
walletFile: process.env.WALLET_FILE
|
|
? process.env.WALLET_FILE
|
|
: `${__dirname.toString()}/../../wallet.json`,
|
|
|
|
// Wallet Configuration
|
|
// Default value: web3 - connect to bch-api through web 3 JSON RPC over IPFS.
|
|
// Alternate value: web2 - connect to bch-api through a web 2 REST API over HTTP.
|
|
walletInterface: process.env.WALLET_INTERFACE ? process.env.WALLET_INTERFACE : 'web3',
|
|
|
|
// Wallet API Server
|
|
// Default web2 server: https://api.fullstack.cash/v5/
|
|
// Default web3 server: https://free-bch.fullstack.cash/
|
|
apiServer: process.env.WALLET_INTERFACE === 'web2'
|
|
? (
|
|
process.env.APISERVER
|
|
? process.env.APISERVER
|
|
: 'https://api.fullstack.cash/v5/'
|
|
)
|
|
: 'https://free-bch.fullstack.cash/',
|
|
|
|
// Basic Authentication Password for connecting to bch-api through a web 2
|
|
// REST API over HTTP.
|
|
authPass: process.env.WALLET_AUTH_PASS
|
|
? process.env.WALLET_AUTH_PASS
|
|
: '',
|
|
|
|
// FullStack.cash account information, used for automatic JWT handling.
|
|
getJwtAtStartup: process.env.GET_JWT_AT_STARTUP ? true : false,
|
|
authServer: process.env.AUTHSERVER
|
|
? process.env.AUTHSERVER
|
|
: 'https://auth.fullstack.cash',
|
|
fullstackLogin: process.env.FULLSTACKLOGIN
|
|
? process.env.FULLSTACKLOGIN
|
|
: 'demo@demo.com',
|
|
fullstackPassword: process.env.FULLSTACKPASS
|
|
? process.env.FULLSTACKPASS
|
|
: 'demo',
|
|
// authPass: process.env.FULLSTACK_AUTH_PASS
|
|
// ? process.env.FULLSTACK_AUTH_PASS
|
|
// : '',
|
|
|
|
// END WALLET CONFIGURATION
|
|
|
|
// BEGIN IPFS CONFIGURATION
|
|
|
|
// Debug verbosity level of helia-coord.
|
|
// 0 = no debug logs. 3 = maximum logs.
|
|
debugLevel: process.env.DEBUG_LEVEL ? parseInt(process.env.DEBUG_LEVEL) : 2,
|
|
|
|
// Enable/Disable the IPFS node at startup. Enabled by default.
|
|
// useIpfs: process.env.DISABLE_IPFS ? false : true,
|
|
useIpfs: false,
|
|
|
|
isCircuitRelay: process.env.ENABLE_CIRCUIT_RELAY ? true : false,
|
|
// SSL domain used for websocket connection via browsers.
|
|
crDomain: process.env.CR_DOMAIN ? process.env.CR_DOMAIN : '',
|
|
|
|
// Information passed to other IPFS peers about this node.
|
|
apiInfo: 'https://ipfs-service-provider.fullstack.cash/',
|
|
|
|
// JSON-LD and Schema.org schema with info about this app.
|
|
announceJsonLd: {
|
|
'@context': 'https://schema.org/',
|
|
'@type': 'WebAPI',
|
|
name: ipfsCoordName,
|
|
version,
|
|
protocol: 'generic-service',
|
|
description: 'This is a generic IPFS Serivice Provider that uses JSON RPC over IPFS to communicate with it. This instance has not been customized. Source code: https://github.com/Permissionless-Software-Foundation/ipfs-service-provider',
|
|
documentation: 'https://ipfs-service-provider.fullstack.cash/',
|
|
provider: {
|
|
'@type': 'Organization',
|
|
name: 'Permissionless Software Foundation',
|
|
url: 'https://PSFoundation.cash'
|
|
},
|
|
|
|
// If this node has an IP4 address or domain name used to provide a REST API.
|
|
web2Api: process.env.WEB2_API ? process.env.WEB2_API : null
|
|
},
|
|
|
|
// P2WDB webhook endpoint
|
|
p2wdbPort: process.env.P2WDB_PORT ? process.env.P2WDB_PORT : 5010,
|
|
webhookService: process.env.WEBHOOKSERVICE
|
|
? process.env.WEBHOOKSERVICE
|
|
: 'http://localhost:5010/webhook', // P2WDB.
|
|
p2wdbAppId: process.env.APP_ID ? process.env.APP_ID : 'bch-dex-001',
|
|
webhookTarget: process.env.WEBHOOKTARGET
|
|
? process.env.WEBHOOKTARGET
|
|
: 'http://localhost:5700/p2wdb',
|
|
|
|
// IPFS Ports
|
|
ipfsTcpPort: process.env.IPFS_TCP_PORT ? process.env.IPFS_TCP_PORT : 4001,
|
|
ipfsWsPort: process.env.IPFS_WS_PORT ? process.env.IPFS_WS_PORT : 4003,
|
|
ipfsWebRtcPort: process.env.IPFS_WEB_RTC_PORT ? process.env.IPFS_WEB_RTC_PORT : 4005,
|
|
connectPref: process.env.CONNECT_PREF, // Used in helia-coord to select connection preference.
|
|
|
|
// Settings for production, using external go-ipfs node.
|
|
isProduction: process.env.SVC_ENV === 'prod' ? true : false,
|
|
ipfsHost: process.env.IPFS_HOST ? process.env.IPFS_HOST : 'localhost',
|
|
ipfsApiPort: process.env.IPFS_API_PORT
|
|
? parseInt(process.env.IPFS_API_PORT)
|
|
: 5001,
|
|
|
|
chatPubSubChan: 'psf-ipfs-chat-001',
|
|
|
|
// IPFS gateway
|
|
ipfsGateway: process.env.IPFS_GATEWAY ? process.env.IPFS_GATEWAY : 'https://pin.fullstack.cash/ipfs/download/',
|
|
|
|
// This can add specific Circuit Relay v2 servers to connect to.
|
|
bootstrapRelays: [
|
|
// v2 Circuit Relay (Token Tiger)
|
|
// '/ip4/137.184.93.145/tcp/8001/p2p/12D3KooWGMEKkdJfyZbwdH9EafZbRTtMn7FnhWPrE4MhRty2763g',
|
|
|
|
// v2 Circuit Relay server (FullStack.cash)
|
|
// '/ip4/78.46.129.7/tcp/4001/p2p/12D3KooWFQ11GQ5NubsJGhYZ4X3wrAGimLevxfm6HPExCrMYhpSL'
|
|
],
|
|
|
|
// END IPFS CONFIGURATION
|
|
|
|
// Nostr
|
|
nostrRelay: process.env.NOSTR_RELAY ? process.env.NOSTR_RELAY : 'wss://nostr-relay.psfoundation.info',
|
|
nostrTopic: process.env.NOSTR_TOPIC ? process.env.NOSTR_TOPIC : 'bch-dex-test-topic-02',
|
|
nostrGlobalFeed: process.env.NOSTR_GLOBAL_FEED ? process.env.NOSTR_GLOBAL_FEED : 'slpdex-socialmedia',
|
|
|
|
// Account Configuration
|
|
disableNewAccounts: process.env.DISABLE_NEW_ACCOUNTS ? true : false,
|
|
|
|
// Admin password
|
|
adminPassword: process.env.ADMIN_PASSWORD,
|
|
|
|
// The Operator of BCH DEX can elect to receive a percentage of each sale.
|
|
operatorAddress: process.env.OPERATOR_ADDRESS ? process.env.OPERATOR_ADDRESS : 'bitcoincash:qqsrke9lh257tqen99dkyy2emh4uty0vky9y0z0lsr',
|
|
operatorPercentage: process.env.OPERATOR_PERCENTAGE ? parseFloat(process.env.OPERATOR_PERCENTAGE) : 2.0
|
|
}
|