Browse Source

options must be manually set

Kieran Gibb 2 years ago
parent
commit
c0b8835616
No known key found for this signature in database
2 changed files with 11 additions and 2 deletions
  1. 2
    2
      index.js
  2. 9
    0
      test/index.test.js

+ 2
- 2
index.js View File

@@ -34,7 +34,7 @@ class CoBoxConfig {
34 34
 
35 35
     mkdirp.sync(path.join(this.root, 'logs'))
36 36
 
37
-    var config = Object.assign(defaultConfig(this._opts))
37
+    var config = Object.assign(defaultConfig())
38 38
 
39 39
     if (!fs.existsSync(this.storage)) {
40 40
       fs.writeFileSync(this.storage, yaml.safeDump(defaultConfig(), { sortKeys: true }))
@@ -85,7 +85,7 @@ class CoBoxConfig {
85 85
       this._groups = config.groups
86 86
       this._identities = config.identities
87 87
       this._replicators = config.replicators
88
-      this._options = config.options || this.defaultOptions
88
+      this._options = config.options
89 89
       return true
90 90
     } catch (err) {
91 91
       console.error(err)

+ 9
- 0
test/index.test.js View File

@@ -56,3 +56,12 @@ describe('master_key', (context) => {
56 56
     cleanup(storage, next)
57 57
   })
58 58
 })
59
+
60
+describe('options', (context) => {
61
+  context('reload', (assert, next) => {
62
+    var storage = tmp()
63
+    var config = Config(storage, { hello: true })
64
+    assert.notOk(config.options.get('hello'), 'options must be manually set')
65
+    cleanup(storage, next)
66
+  })
67
+})