Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add documentation on COUCH2PG_USERS_META_DOC_LIMIT and add safeNum safety #100

Merged
merged 2 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
};
};