All files index.js

0% Statements 0/22
0% Branches 0/6
0% Functions 0/6
0% Lines 0/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51                                                                                                     
#!/usr/bin/env node
 
import winston from 'winston'
import dotenv from 'dotenv'
 
dotenv.config()
 
import { initializeBlockstackCore, configureRegtest } from './developmode'
import { makeHTTPServer } from './http'
import { getConfig } from './config'
import { config as bskConfig } from 'blockstack'
import { StacksMainnet, StacksTestnet } from '@stacks/network'
 
if (process.env.BSK_SUBDOMAIN_TESTNET) {
  bskConfig.network = new StacksTestnet()
} else {
  bskConfig.network = new StacksMainnet()
}
 
const config = getConfig()
 
winston.configure(config.winstonConfig)
 
 
if (config.regtest) {
  configureRegtest()
}
 
if (config.development) {
  initializationPromise = initializationPromise
    .then((server) => {
      return initializeBlockstackCore().then(() => server)
    })
    .catch((err) => {
      winston.error(err)
      winston.error(err.stack)
      throw err
    })
}
let initializationPromise = makeHTTPServer(config).catch((err) => {
  winston.error(err)
  winston.error(err.stack)
  throw err
})
 
initializationPromise.then((server) => {
  server.listen(config.port, () => {
    console.log('Subdomain registrar started on', config.port)
  })
})