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

Implementation of simple consent #53

Merged
merged 3 commits into from
Apr 26, 2021

Conversation

kompotkot
Copy link
Contributor

No description provided.

@@ -2,6 +2,38 @@
This module implements Humbug's user consent mechanisms.
*/

type Yes = "1" | "t" | "y" | "T" | "Y" | "true" | "yes" | "True" | "Yes" | "TRUE" | "YES"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should still have these.

}
}

function environmentVariableOptOut(): boolean {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BUGGER_OFF=true is not for libraries integrating with humbug, it is for the end user.

If someone who is using humbug in their library wants to have environmentVariableOptOut, we should implement similiarly as in humbug/python.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should instead be like this:

function environmentVariableOptOut(envVar: string, optOutValues: Array<string>): func():bool {
    return func(): bool {
        const envVal = process.env[envVar];
        return optOutValues.includes(envVal);
    }
}

}

check(): boolean {
if (this.mechanisms === false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (Yes.includes(process.env.BUGGER_OFF)) {
    return false;
}

Copy link
Member

@zomglings zomglings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@zomglings zomglings merged commit 33a825a into bugout-dev:main Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants