Skip to content

Commit

Permalink
feat: don’t write files when run in memory
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Jun 16, 2016
1 parent 9bd0599 commit 0bfc95a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions server/config/assure-folders.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ var parallel = require('async').parallel
var mkdirp = require('mkdirp')

function assureFolders (state, callback) {
if (state.config.inMemory) {
return callback()
}

var tasks = [
mkdirp.bind(null, state.config.paths.data)
]
Expand Down
12 changes: 7 additions & 5 deletions server/config/db/pouchdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function pouchDbConfig (state, callback) {
charset: 'hex'
})

if (adminPassword) {
if (!state.config.inMemory && adminPassword) {
jsonfile.writeFileSync(storePath, Object.assign(store, {
couch_httpd_auth_secret: secret
}), {spaces: 2})
Expand Down Expand Up @@ -55,10 +55,12 @@ function pouchDbConfig (state, callback) {
admin: '-pbkdf2-' + doc.derived_key + ',' + doc.salt + ',10'
}

jsonfile.writeFileSync(storePath, Object.assign(store, {
couch_httpd_auth_secret: secret,
admins: state.config.db.admins
}), {spaces: 2})
if (!state.config.inMemory) {
jsonfile.writeFileSync(storePath, Object.assign(store, {
couch_httpd_auth_secret: secret,
admins: state.config.db.admins
}), {spaces: 2})
}

callback(null, state.config)
})
Expand Down

0 comments on commit 0bfc95a

Please sign in to comment.