rest-hapi.js
async function registerMrHorse(server, logger, config) {
  const Log = logger.bind('register-MrHorse')

  let policyPath = ''

  if (config.enablePolicies) {
    if (config.absolutePolicyPath === true) {
      policyPath = config.policyPath
    } else {
      policyPath = __dirname.replace(
        'node_modules/rest-hapi',
        config.policyPath
      )
    }
  } else {
    policyPath = path.join(__dirname, '/policies')
  }
  await server.register([
    {
      plugin: Mrhorse,
      options: {
        policyDirectory: policyPath
      }
    }
  ])

  if (config.enablePolicies) {
    await server.plugins.mrhorse.loadPolicies(server, {
      policyDirectory: path.join(__dirname, '/policies')
    })
  }

  Log.info('MrHorse plugin registered')
}
async function registerMrHorse(server, logger, config) {
  const Log = logger.bind('register-MrHorse')

  let policyPath = ''

  if (config.enablePolicies) {
    if (config.absolutePolicyPath === true) {
      policyPath = config.policyPath
    } else {
      policyPath = __dirname.replace(
        'node_modules/rest-hapi',
        config.policyPath
      )
    }
  } else {
    policyPath = path.join(__dirname, '/policies')
  }
  await server.register([
    {
      plugin: Mrhorse,
      options: {
        policyDirectory: policyPath
      }
    }
  ])

  if (config.enablePolicies) {
    await server.plugins.mrhorse.loadPolicies(server, {
      policyDirectory: path.join(__dirname, '/policies')
    })
  }

  Log.info('MrHorse plugin registered')
}
async function registerMrHorse ( server , logger , config ) { const Log = logger . bind ( 'register-MrHorse' ) let policyPath = '' if ( config . enablePolicies ) { if ( config . absolutePolicyPath === true ) { policyPath = config . policyPath } else { policyPath = __dirname . replace ( 'node_modules/rest-hapi' , config . policyPath ) } } else { policyPath = path . join ( __dirname , '/policies' ) } await server . register ( [ { plugin : Mrhorse , options : { policyDirectory : policyPath } } ] ) if ( config . enablePolicies ) { await server . plugins . mrhorse . loadPolicies ( server , { policyDirectory : path . join ( __dirname , '/policies' ) } ) } Log . info ( 'MrHorse plugin registered' ) }
Register and configure the mrhorse plugin.
@param server
@param logger
@param config
@returns {Promise<void>}
Register and configure the mrhorse plugin .