Skip to content
Permalink
Browse files

(flavor) objection v3.0.0

  • Loading branch information
devinivy committed Apr 12, 2021
1 parent 839e7af commit 66973ef4e5cd7b68289eabd3f78c351a10e454f2
@@ -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
);
Empty file.
Empty file.
@@ -0,0 +1,7 @@
'use strict';

module.exports = {
options: {
migrationsDir: `${__dirname}/../migrations`
}
};
@@ -10,14 +10,20 @@
"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",
"@hapi/eslint-config-hapi": "13.x.x",
"@hapi/eslint-plugin-hapi": "4.x.x",
"@hapi/glue": "8.x.x",
"@hapi/hapi": "20.x.x",
"@hapi/hoek": "9.x.x",
"@hapi/lab": "24.x.x",
"@hapipal/confidence": "6.x.x",
"@hapipal/hpal": "3.x.x",
@@ -26,6 +32,8 @@
"babel-eslint": "10.x.x",
"dotenv": "8.x.x",
"eslint": "7.x.x",
"exiting": "6.x.x"
"exiting": "6.x.x",
"knex": "0.21.x",
"sqlite3": "5.x.x"
}
}
@@ -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` });
@@ -33,6 +34,29 @@ module.exports = new Confidence.Store({
plugin: '../lib', // Main plugin
options: {}
},
{
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
}
}
},
{
plugin: {
$filter: 'NODE_ENV',

0 comments on commit 66973ef

Please sign in to comment.