feat: decouple l-s entrypoint
This commit is contained in:
parent
2a2c1fccc8
commit
f4d6b5e454
48 changed files with 411 additions and 232 deletions
|
|
@ -13,20 +13,20 @@ const BN = require('./bn')
|
|||
const anonymous = require('../lib/constants').anonymousCustomer
|
||||
const complianceOverrides = require('./compliance_overrides')
|
||||
const users = require('./users')
|
||||
const options = require('./options')
|
||||
const writeFile = util.promisify(fs.writeFile)
|
||||
const notifierQueries = require('./notifier/queries')
|
||||
const notifierUtils = require('./notifier/utils')
|
||||
const NUM_RESULTS = 1000
|
||||
const idPhotoCardBasedir = _.get('idPhotoCardDir', options)
|
||||
const frontCameraBaseDir = _.get('frontCameraDir', options)
|
||||
const operatorDataDir = _.get('operatorDataDir', options)
|
||||
const sms = require('./sms')
|
||||
const settingsLoader = require('./new-settings-loader')
|
||||
const logger = require('./logger')
|
||||
|
||||
const TX_PASSTHROUGH_ERROR_CODES = ['operatorCancel']
|
||||
|
||||
const ID_PHOTO_CARD_DIR = process.env.ID_PHOTO_CARD_DIR
|
||||
const FRONT_CAMERA_DIR = process.env.FRONT_CAMERA_DIR
|
||||
const OPERATOR_DATA_DIR = process.env.OPERATOR_DATA_DIR
|
||||
|
||||
/**
|
||||
* Add new customer
|
||||
*
|
||||
|
|
@ -673,7 +673,7 @@ function updatePhotoCard (id, patch) {
|
|||
const rpath = _.join(path.sep, _.map(_.wrap(_.join, ''), _.take(3, _.chunk(2, _.split('', hash)))))
|
||||
|
||||
// i.e. ../<lamassu-server-home>/idphotocard/24/0e/85
|
||||
const dirname = path.join(idPhotoCardBasedir, rpath)
|
||||
const dirname = path.join(ID_PHOTO_CARD_DIR, rpath)
|
||||
|
||||
// create the directory tree if needed
|
||||
_.attempt(() => makeDir.sync(dirname))
|
||||
|
|
@ -736,7 +736,7 @@ function updatePhotos (imagesData, id, dir) {
|
|||
function updateIdCardData (patch, id) {
|
||||
/* TODO: fetch operator id */
|
||||
const operatorId = 'id-operator'
|
||||
const directory = `${operatorDataDir}/${operatorId}/${id}/`
|
||||
const directory = `${OPERATOR_DATA_DIR}/${operatorId}/${id}/`
|
||||
|
||||
return Promise.resolve(patch)
|
||||
.then(patch => {
|
||||
|
|
@ -755,7 +755,7 @@ function updateTxCustomerPhoto (imageData) {
|
|||
return Promise.resolve(imageData)
|
||||
.then(imageData => {
|
||||
const newPatch = {}
|
||||
const directory = `${operatorDataDir}/customersphotos`
|
||||
const directory = `${OPERATOR_DATA_DIR}/customersphotos`
|
||||
|
||||
if (_.isEmpty(imageData)) {
|
||||
return
|
||||
|
|
@ -826,7 +826,7 @@ function updateFrontCamera (id, patch) {
|
|||
const rpath = _.join(path.sep, _.map(_.wrap(_.join, ''), _.take(3, _.chunk(2, _.split('', hash)))))
|
||||
|
||||
// i.e. ../<lamassu-server-home>/idphotocard/24/0e/85
|
||||
const dirname = path.join(frontCameraBaseDir, rpath)
|
||||
const dirname = path.join(FRONT_CAMERA_DIR, rpath)
|
||||
|
||||
// create the directory tree if needed
|
||||
_.attempt(() => makeDir.sync(dirname))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue