File tree Expand file tree Collapse file tree 6 files changed +62
-2
lines changed
Expand file tree Collapse file tree 6 files changed +62
-2
lines changed Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const Path = require ( 'path' ) ;
4+ const Hoek = require ( '@hapi/hoek' ) ;
5+ const Manifest = require ( './server/manifest' ) ;
6+ const Plugin = require ( './lib/plugins/@hapipal.schwifty' ) ;
7+
8+ // Take schwifty registration's knex option
9+ // but specify the plugin's migrations directory
10+
11+ module . exports = Hoek . applyToDefaults (
12+ {
13+ migrations : {
14+ directory : Path . relative ( process . cwd ( ) , Plugin . options . migrationsDir )
15+ }
16+ } ,
17+ Manifest
18+ . get ( '/register/plugins' , process . env )
19+ . find ( ( { plugin } ) => plugin === '@hapipal/schwifty' )
20+ . options . knex
21+ ) ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ module . exports = {
4+ options : {
5+ migrationsDir : `${ __dirname } /../migrations`
6+ }
7+ } ;
Original file line number Diff line number Diff line change 1010 "dependencies" : {
1111 "@hapi/boom" : " 9.x.x" ,
1212 "@hapipal/haute-couture" : " 4.x.x" ,
13- "joi" : " 17.x.x"
13+ "@hapipal/schwifty" : " 6.x.x" ,
14+ "joi" : " 17.x.x" ,
15+ "objection" : " 2.x.x"
16+ },
17+ "peerDependencies" : {
18+ "knex" : " 0.21.x"
1419 },
1520 "devDependencies" : {
1621 "@hapi/code" : " 8.x.x" ,
1722 "@hapi/eslint-config-hapi" : " 13.x.x" ,
1823 "@hapi/eslint-plugin-hapi" : " 4.x.x" ,
1924 "@hapi/glue" : " 8.x.x" ,
2025 "@hapi/hapi" : " 20.x.x" ,
26+ "@hapi/hoek" : " 9.x.x" ,
2127 "@hapi/lab" : " 24.x.x" ,
2228 "@hapipal/confidence" : " 6.x.x" ,
2329 "@hapipal/hpal" : " 3.x.x" ,
2632 "babel-eslint" : " 10.x.x" ,
2733 "dotenv" : " 8.x.x" ,
2834 "eslint" : " 7.x.x" ,
29- "exiting" : " 6.x.x"
35+ "exiting" : " 6.x.x" ,
36+ "knex" : " 0.21.x" ,
37+ "sqlite3" : " 5.x.x"
3038 }
3139}
Original file line number Diff line number Diff line change 33const Dotenv = require ( 'dotenv' ) ;
44const Confidence = require ( '@hapipal/confidence' ) ;
55const Toys = require ( '@hapipal/toys' ) ;
6+ const Schwifty = require ( '@hapipal/schwifty' ) ;
67
78// Pull .env into process.env
89Dotenv . config ( { path : `${ __dirname } /.env` } ) ;
@@ -33,6 +34,29 @@ module.exports = new Confidence.Store({
3334 plugin : '../lib' , // Main plugin
3435 options : { }
3536 } ,
37+ {
38+ plugin : '@hapipal/schwifty' ,
39+ options : {
40+ $filter : 'NODE_ENV' ,
41+ $default : { } ,
42+ $base : {
43+ migrateOnStart : true ,
44+ knex : {
45+ client : 'sqlite3' ,
46+ useNullAsDefault : true , // Suggested for sqlite3
47+ connection : {
48+ filename : ':memory:'
49+ } ,
50+ migrations : {
51+ stub : Schwifty . migrationsStubPath
52+ }
53+ }
54+ } ,
55+ production : {
56+ migrateOnStart : false
57+ }
58+ }
59+ } ,
3660 {
3761 plugin : {
3862 $filter : 'NODE_ENV' ,
You can’t perform that action at this time.
0 commit comments