Skip to content

Commit 6dc2afc

Browse files
committed
chore: Opt out of Bolt analytics
1 parent 47d972e commit 6dc2afc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: src/Bolt/ProtocolFactory.php

+13
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,20 @@ class ProtocolFactory
3232
*/
3333
public function createProtocol(IConnection $connection, AuthenticateInterface $auth, string $userAgent): array
3434
{
35+
$boltAnalyticsOptOut = getenv('BOLT_ANALYTICS_OPTOUT');
36+
$boltAnalyticsOptOutWasSet = false;
37+
/** @psalm-suppress RiskyTruthyFalsyComparison */
38+
if (empty($boltAnalyticsOptOut)) {
39+
putenv('BOLT_ANALYTICS_OPTOUT=1');
40+
$boltAnalyticsOptOutWasSet = true;
41+
}
42+
3543
$bolt = new Bolt($connection);
44+
45+
if ($boltAnalyticsOptOutWasSet) {
46+
putenv('BOLT_ANALYTICS_OPTOUT');
47+
}
48+
3649
$bolt->setProtocolVersions(5.4, 5.3, 5, 4.4);
3750

3851
try {

0 commit comments

Comments
 (0)