Skip to content

Commit

Permalink
Add documentation on COUCH2PG_USERS_META_DOC_LIMIT and add safeNum sa…
Browse files Browse the repository at this point in the history
…fety (#100)
  • Loading branch information
njogz authored Sep 16, 2021
1 parent 3e38727 commit 4eb0584
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ The supported environment variables are:
| -------------------- | ---------------------------------------------------------------------------------------------------------- |
| POSTGRESQL_URL | PostgreSQL instance URL, format: `postgres://[user]:[password]@localhost:[port]/[database name]` |
| COUCHDB_URL | CouchDB instance URL, format: `https://[user]:[password]@localhost:[port]/medic` |
| COUCH2PG_SLEEP_MINS | Number of minutes between synchronization |
| COUCH2PG_SLEEP_MINS | Number of minutes between synchronization. It defaults to 50 if this variable is not explicitly set. |
| COUCH2PG_DOC_LIMIT | Number of documents cht-couch2pg fetches from CouchDB everytime |
| COUCH2PG_RETRY_COUNT | Number of times cht-couch2pg will retry synchronizing documents from CouchDB after experiencing an error |
| COUCH2PG_USERS_META_DOC_LIMIT | Number of documents to grab concurrently from the users-meta database. These documents are larger so set a limit lower than the docLimit. It defaults to 50 if this variable is not explicitly set. |

Example:
```
Expand Down
4 changes: 2 additions & 2 deletions env.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function() {
docLimit: safeNum(process.env.COUCH2PG_DOC_LIMIT),
changesLimit: safeNum(process.env.COUCH2PG_CHANGES_LIMIT),
retryCount: safeNum(process.env.COUCH2PG_RETRY_COUNT),
sleepMins: (safeNum(process.env.COUCH2PG_SLEEP_MINS) || 60),
couchdbUsersMetaDocLimit: process.env.COUCH2PG_USERS_META_DOC_LIMIT || 50,
sleepMins: safeNum(process.env.COUCH2PG_SLEEP_MINS) || 60,
couchdbUsersMetaDocLimit: safeNum(process.env.COUCH2PG_USERS_META_DOC_LIMIT) || 50,
};
};

0 comments on commit 4eb0584

Please sign in to comment.