feat: decouple l-s entrypoint
This commit is contained in:
parent
2a2c1fccc8
commit
f4d6b5e454
48 changed files with 411 additions and 232 deletions
|
|
@ -4,23 +4,24 @@ const util = require('util')
|
|||
const loader = require('./loading')
|
||||
const matcher = require('./matching')
|
||||
const nameUtils = require('./name-utils')
|
||||
const options = require('../options')
|
||||
const _ = require('lodash/fp')
|
||||
const logger = require('../logger')
|
||||
|
||||
const debugLog = require('../pp')(__filename) // KOSTIS TODO: remove
|
||||
|
||||
const OFAC_DATA_DIR = process.env.OFAC_DATA_DIR
|
||||
|
||||
let structs = null
|
||||
|
||||
const readdir = util.promisify(fs.readdir)
|
||||
|
||||
function load () {
|
||||
if (!options.ofacDataDir) {
|
||||
const message = 'The ofacDataDir option has not been set in lamassu.json'
|
||||
if (!OFAC_DATA_DIR) {
|
||||
const message = 'The ofacDataDir option has not been set in the environment'
|
||||
return Promise.reject(new Error(message))
|
||||
}
|
||||
|
||||
const ofacSourcesDir = path.join(options.ofacDataDir, 'sources')
|
||||
const ofacSourcesDir = path.join(OFAC_DATA_DIR, 'sources')
|
||||
|
||||
return readdir(ofacSourcesDir)
|
||||
.then(_.flow(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue