iut-hapi/server/manifest.js

73 lines
2.0 KiB
JavaScript
Raw Normal View History

2024-01-25 15:36:58 +00:00
'use strict';
const Dotenv = require('dotenv');
const Confidence = require('@hapipal/confidence');
const Toys = require('@hapipal/toys');
2021-04-12 03:24:33 +00:00
const Schwifty = require('@hapipal/schwifty');
2024-01-25 15:36:58 +00:00
// Pull .env into process.env
Dotenv.config({ path: `${__dirname}/.env` });
// Glue manifest as a confidence store
module.exports = new Confidence.Store({
server: {
host: 'localhost',
port: {
2024-01-26 13:37:10 +00:00
$env: 'PORT',
2024-01-25 15:36:58 +00:00
$coerce: 'number',
$default: 3000
},
debug: {
2024-01-26 13:37:10 +00:00
$filter: { $env: 'NODE_ENV' },
2024-01-25 15:36:58 +00:00
$default: {
2024-01-26 13:37:10 +00:00
log: ['error'],
2024-01-25 15:36:58 +00:00
request: ['error']
},
production: {
request: ['implementation']
}
}
},
register: {
plugins: [
{
plugin: '../lib', // Main plugin
options: {}
},
2024-01-26 13:37:10 +00:00
{
plugin: './plugins/swagger'
},
2021-04-12 03:24:33 +00:00
{
plugin: '@hapipal/schwifty',
options: {
$filter: 'NODE_ENV',
$default: {},
$base: {
migrateOnStart: true,
knex: {
client: 'sqlite3',
useNullAsDefault: true, // Suggested for sqlite3
connection: {
filename: ':memory:'
},
migrations: {
stub: Schwifty.migrationsStubPath
}
}
},
production: {
migrateOnStart: false
}
}
},
2024-01-25 15:36:58 +00:00
{
plugin: {
2024-01-26 13:37:10 +00:00
$filter: { $env: 'NODE_ENV' },
2024-01-25 15:36:58 +00:00
$default: '@hapipal/hpal-debug',
production: Toys.noop
}
}
]
}
});