-
Notifications
You must be signed in to change notification settings - Fork 8
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
Change syncAllowance default value as an environment variable #158
Conversation
src/services/sync-checker.ts
Outdated
@@ -8,6 +8,8 @@ const logger = require('../services/logger') | |||
|
|||
import axios from 'axios' | |||
|
|||
const DEFAULT_SYNC_ALLOWANCE: number = parseInt(process.env.DEFAULT_SYNC_ALLOWANCE) || 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather have all of the .env variables checked in one place and rather than silently fallback to a default, I'd rather it error out and tell you that you made a dumb mistake and forgot the var.
Probably around here:
Line 59 in bddc518
const aatPlan = process.env.AAT_PLAN || AatPlans.PREMIUM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like having .env
vars in one place—this is how I usually do it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does look nicer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, like it too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for now I'm doing a quick fix but an issue can be opened for that to change all the envs
const pocketBlockTime: string = process.env.POCKET_BLOCK_TIME || '' | ||
const relayRetries: string = process.env.POCKET_RELAY_RETRIES || '' | ||
const databaseEncryptionKey: string = process.env.DATABASE_ENCRYPTION_KEY || '' | ||
const defaultSyncAllowance: number = parseInt(process.env.DEFAULT_SYNC_ALLOWANCE) || -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is 0 a valid value or must always be over 0? @nymd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 is valid though it would be very restrictive. It should be allowed. But not blank or undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all right, then this is ready
Fixes #156