lamassu-server/packages/server/tools/build-prod-env.js
siiky e10493abc6 Merge branch 'dev' into feat/lam-1291/stress-testing
* dev: (85 commits)
  chore: console.log debug leftovers
  fix: third level navigation links
  fix: show subheader on refresh
  fix: machines/:id routing
  fix: customer route
  chore: update wallet nodes
  feat: shorten long addresses in funding page
  feat: shorten long addresses
  refactor: support copied text different from presented text
  chore: udpate react, downshift and routing
  refactor: use Wizard component on first route
  fix: autocomplete component rendering
  feat: skip2fa option on .env
  fix: drop contraint before dropping index
  chore: stop using alias imports
  fix: re-instate urlResolver
  chore: server code formatting
  chore: reformat code
  chore: adding eslint and prettier config
  chore: typo
  ...
2025-05-20 11:59:44 +01:00

58 lines
2.1 KiB
JavaScript

const fs = require('fs')
const path = require('path')
const argv = require('minimist')(process.argv.slice(2))
const _ = require('lodash/fp')
const setEnvVariable = require('./set-env-var')
const requiredParams = ['db-password', 'hostname']
if (!_.isEqual(_.intersection(_.keys(argv), requiredParams), requiredParams)) {
console.error(
'Usage: node tools/build-prod-env.js --db-password <DB_PASSWORD> --hostname <IP>',
)
process.exit(2)
}
fs.copyFileSync(
path.resolve(__dirname, '../.sample.env'),
path.resolve('/etc', 'lamassu', '.env'),
)
setEnvVariable('NODE_ENV', 'production')
setEnvVariable('POSTGRES_USER', 'lamassu_pg')
setEnvVariable('POSTGRES_PASSWORD', `${argv['db-password']}`)
setEnvVariable('POSTGRES_HOST', 'localhost')
setEnvVariable('POSTGRES_PORT', '5432')
setEnvVariable('POSTGRES_DB', 'lamassu')
setEnvVariable('CA_PATH', `/etc/ssl/certs/Lamassu_OP_Root_CA.pem`)
setEnvVariable('CERT_PATH', `/etc/ssl/certs/Lamassu_OP.pem`)
setEnvVariable('KEY_PATH', `/etc/ssl/private/Lamassu_OP.key`)
setEnvVariable('MNEMONIC_PATH', `/etc/lamassu/mnemonics/mnemonic.txt`)
setEnvVariable('BLOCKCHAIN_DIR', `/mnt/blockchains`)
setEnvVariable('OFAC_DATA_DIR', `/var/lamassu/ofac`)
setEnvVariable('ID_PHOTO_CARD_DIR', `/opt/lamassu-server/idphotocard`)
setEnvVariable('FRONT_CAMERA_DIR', `/opt/lamassu-server/frontcamera`)
setEnvVariable('OPERATOR_DATA_DIR', `/opt/lamassu-server/operatordata`)
setEnvVariable('COIN_ATM_RADAR_URL', `https://coinatmradar.info/api/lamassu/`)
setEnvVariable('BTC_NODE_LOCATION', 'local')
setEnvVariable('BTC_WALLET_LOCATION', 'local')
setEnvVariable('BCH_NODE_LOCATION', 'local')
setEnvVariable('BCH_WALLET_LOCATION', 'local')
setEnvVariable('LTC_NODE_LOCATION', 'local')
setEnvVariable('LTC_WALLET_LOCATION', 'local')
setEnvVariable('DASH_NODE_LOCATION', 'local')
setEnvVariable('DASH_WALLET_LOCATION', 'local')
setEnvVariable('ZEC_NODE_LOCATION', 'local')
setEnvVariable('ZEC_WALLET_LOCATION', 'local')
setEnvVariable('XMR_NODE_LOCATION', 'local')
setEnvVariable('XMR_WALLET_LOCATION', 'local')
setEnvVariable('HOSTNAME', `${argv.hostname}`)
setEnvVariable('LOG_LEVEL', 'info')