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 10
10
"dependencies" : {
11
11
"@hapi/boom" : " 9.x.x" ,
12
12
"@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"
14
19
},
15
20
"devDependencies" : {
16
21
"@hapi/code" : " 8.x.x" ,
17
22
"@hapi/eslint-config-hapi" : " 13.x.x" ,
18
23
"@hapi/eslint-plugin-hapi" : " 4.x.x" ,
19
24
"@hapi/glue" : " 8.x.x" ,
20
25
"@hapi/hapi" : " 20.x.x" ,
26
+ "@hapi/hoek" : " 9.x.x" ,
21
27
"@hapi/lab" : " 24.x.x" ,
22
28
"@hapipal/confidence" : " 6.x.x" ,
23
29
"@hapipal/hpal" : " 3.x.x" ,
26
32
"babel-eslint" : " 10.x.x" ,
27
33
"dotenv" : " 8.x.x" ,
28
34
"eslint" : " 7.x.x" ,
29
- "exiting" : " 6.x.x"
35
+ "exiting" : " 6.x.x" ,
36
+ "knex" : " 0.21.x" ,
37
+ "sqlite3" : " 5.x.x"
30
38
}
31
39
}
Original file line number Diff line number Diff line change 3
3
const Dotenv = require ( 'dotenv' ) ;
4
4
const Confidence = require ( '@hapipal/confidence' ) ;
5
5
const Toys = require ( '@hapipal/toys' ) ;
6
+ const Schwifty = require ( '@hapipal/schwifty' ) ;
6
7
7
8
// Pull .env into process.env
8
9
Dotenv . config ( { path : `${ __dirname } /.env` } ) ;
@@ -33,6 +34,29 @@ module.exports = new Confidence.Store({
33
34
plugin : '../lib' , // Main plugin
34
35
options : { }
35
36
} ,
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
+ } ,
36
60
{
37
61
plugin : {
38
62
$filter : 'NODE_ENV' ,
You can’t perform that action at this time.
0 commit comments