Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getConfig(options = {}) {
// create a new config module for chainpoint
// this will set the prefix to `~/.chainpoint`
// and also parse env vars that are prefixed with `CHAINPOINT_`
config = new Config('chainpoint')
config.inject(options)
config.load({
// Parse URL hash
hash: true,
// Parse querystring
query: true,
// Parse environment
env: true,
// Parse args
argv: true
})
// Will parse [PREFIX]/chainpoint.conf (throws on FS error).
// PREFIX defaults to `~/.chainpoint`
// can change the prefix by passing in a `prefix` option
config.open('chainpoint.conf')
export const run = async () => {
dotenv.config()
const config: Bcfg = new Config('batch-submitter')
config.load({
env: true,
argv: true,
})
// Parse config
const env = process.env
const environment = config.str('node-env', env.NODE_ENV)
const network = config.str('eth-network-name', env.ETH_NETWORK_NAME)
const release = `batch-submitter@${env.npm_package_version}`
const sentryDsn = config.str('sentry-dsn', env.SENTRY_DSN)
const sentryTraceRate = config.ufloat(
'sentry-trace-rate',
parseFloat(env.SENTRY_TRACE_RATE) || 0.05
)
const main = async () => {
const config: Bcfg = new Config('message-relayer')
config.load({
env: true,
argv: true,
})
const env = process.env
const L2_NODE_WEB3_URL = config.str('l2-node-web3-url', env.L2_NODE_WEB3_URL)
const L1_NODE_WEB3_URL = config.str('l1-node-web3-url', env.L1_NODE_WEB3_URL)
const ADDRESS_MANAGER_ADDRESS = config.str(
'address-manager-address',
env.ADDRESS_MANAGER_ADDRESS
)
const L1_WALLET_KEY = config.str('l1-wallet-key', env.L1_WALLET_KEY)
const MNEMONIC = config.str('mnemonic', env.MNEMONIC)
const HD_PATH = config.str('hd-path', env.HD_PATH)
const RELAY_GAS_LIMIT = config.uint(
;(async () => {
try {
dotenv.config()
const config: Bcfg = new Config('data-transport-layer')
config.load({
env: true,
argv: true,
})
const service = new L1DataTransportService({
nodeEnv: config.str('node-env', 'development'),
ethNetworkName: config.str('eth-network-name') as ethNetwork,
release: `data-transport-layer@${process.env.npm_package_version}`,
dbPath: config.str('db-path', './db'),
port: config.uint('server-port', 7878),
hostname: config.str('server-hostname', 'localhost'),
confirmations: config.uint('confirmations', 35),
l1RpcProvider: config.str('l1-rpc-endpoint'),
addressManager: config.str('address-manager'),
pollingInterval: config.uint('polling-interval', 5000),