Skip to content

Commit

Permalink
examples: fs.readFileSync -> require
Browse files Browse the repository at this point in the history
  • Loading branch information
mkutny committed Dec 2, 2017
1 parent 2e05d74 commit 23a8fa3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions examples/js/bcc-vs-bch.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const ccxt = require ('../../ccxt.js')
const asTable = require ('as-table')
const log = require ('ololog').configure ({ locate: false })
const fs = require ('fs')
const config = require ('../../keys')


require ('ansicolor').nice;
Expand All @@ -30,9 +30,6 @@ let proxies = [
})
})

// load api keys from config
let config = JSON.parse (fs.readFileSync ('./keys.json', 'utf8'))

// set up api keys appropriately
for (let id in config) {
if (id in exchanges)
Expand Down Expand Up @@ -113,4 +110,4 @@ let proxies = [

process.exit ()

}) ()
}) ()
4 changes: 2 additions & 2 deletions examples/js/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const verbose = process.argv.includes ('--verbose')
//-----------------------------------------------------------------------------

const ccxt = require ('../../ccxt.js')
const fs = require ('fs')
const config = require ('../../keys')
const asTable = require ('as-table')
const util = require ('util')
const log = require ('ololog').configure ({ locate: false })
Expand All @@ -28,7 +28,7 @@ const exchange = new (ccxt)[exchangeId] ({ verbose })

//-----------------------------------------------------------------------------

let apiKeys = JSON.parse (fs.readFileSync ('./keys.json', 'utf8'))[exchangeId]
let apiKeys = config[exchangeId];

Object.assign (exchange, apiKeys)

Expand Down

0 comments on commit 23a8fa3

Please sign in to comment.