master
Devin Ivy 2021-04-11 23:24:33 -04:00 committed by cemal
parent a36720a54d
commit 9ee8f219af
6 changed files with 68 additions and 1 deletions

21
knexfile.js Normal file
View File

@ -0,0 +1,21 @@
'use strict';
const Path = require('path');
const Hoek = require('@hapi/hoek');
const Manifest = require('./server/manifest');
const Plugin = require('./lib/plugins/@hapipal.schwifty');
// Take schwifty registration's knex option
// but specify the plugin's migrations directory
module.exports = Hoek.applyToDefaults(
{
migrations: {
directory: Path.relative(process.cwd(), Plugin.options.migrationsDir)
}
},
Manifest
.get('/register/plugins', process.env)
.find(({ plugin }) => plugin === '@hapipal/schwifty')
.options.knex
);

0
lib/migrations/.gitkeep Normal file
View File

0
lib/models/.gitkeep Normal file
View File

View File

@ -0,0 +1,7 @@
'use strict';
module.exports = {
options: {
migrationsDir: `${__dirname}/../migrations`
}
};

View File

@ -17,7 +17,12 @@
"dependencies": {
"@hapi/boom": "9.x.x",
"@hapipal/haute-couture": "4.x.x",
"joi": "17.x.x"
"@hapipal/schwifty": "6.x.x",
"joi": "17.x.x",
"objection": "2.x.x"
},
"peerDependencies": {
"knex": "0.21.x"
},
"devDependencies": {
"@hapi/code": "8.x.x",
@ -25,7 +30,11 @@
"@hapi/eslint-plugin-hapi": "4.x.x",
"@hapi/glue": "8.x.x",
"@hapi/hapi": "20.x.x",
<<<<<<< HEAD
"@hapi/inert": "6.x.x",
=======
"@hapi/hoek": "9.x.x",
>>>>>>> 66973ef ((flavor) objection v3.0.0)
"@hapi/lab": "24.x.x",
"@hapi/vision": "6.x.x",
"@hapipal/confidence": "6.x.x",
@ -36,6 +45,11 @@
"dotenv": "8.x.x",
"eslint": "7.x.x",
"exiting": "6.x.x",
<<<<<<< HEAD
"hapi-swagger": "14.x.x"
=======
"knex": "0.21.x",
"sqlite3": "5.x.x"
>>>>>>> 66973ef ((flavor) objection v3.0.0)
}
}

View File

@ -3,6 +3,7 @@
const Dotenv = require('dotenv');
const Confidence = require('@hapipal/confidence');
const Toys = require('@hapipal/toys');
const Schwifty = require('@hapipal/schwifty');
// Pull .env into process.env
Dotenv.config({ path: `${__dirname}/.env` });
@ -34,7 +35,31 @@ module.exports = new Confidence.Store({
options: {}
},
{
<<<<<<< HEAD
plugin: './plugins/swagger'
=======
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
}
}
>>>>>>> 66973ef ((flavor) objection v3.0.0)
},
{
plugin: {