Skip to content

fix: Verbose mode is enabled if environment variables VERBOSE or VERBOSE_PARSE_SERVER_PUSH_ADAPTER are set to any value #264

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

Merged
merged 5 commits into from
Jul 8, 2024
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
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
// PushAdapter, it uses GCM for android push, APNS for ios push.
// WEB for web push.
import log from 'npmlog';
import { booleanParser } from './utils.js';

/* istanbul ignore if */
if (process.env.VERBOSE || process.env.VERBOSE_PARSE_SERVER_PUSH_ADAPTER) {
/* c8 ignore start */
if (booleanParser(process.env.VERBOSE || process.env.VERBOSE_PARSE_SERVER_PUSH_ADAPTER)) {
log.level = 'verbose';
}
/* c8 ignore stop */

import ParsePushAdapter from './ParsePushAdapter.js';
import GCM from './GCM.js';
Expand Down
10 changes: 10 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function booleanParser(opt) {
if (opt == true || opt == 'true' || opt == '1') {
return true;
}
return false;
}

export {
booleanParser,
}