consent

package
v0.5.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package consent provides opt-out consent flags stored in ~/.pilot/config.json.

Three flags are recognised: "telemetry", "broadcasts", and "reviews". All flags default to true (opt-out model) when absent from the config file or when the config file does not exist yet.

The config file format is:

{"consent": {"telemetry": true, "broadcasts": true, "reviews": false}}

Writes are atomic: the package reads the existing file, updates only the "consent" subkey, and writes back via a temp-file + rename so the file is never left in a partial state on crash.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConsent

func GetConsent(home, flag string) bool

GetConsent returns the consent value for flag ("telemetry", "broadcasts", "reviews"). It defaults to true (opt-out model) when the flag is absent from the config file, or when the config file does not exist yet. Unknown flag names also return true so that callers which don't validate the flag name beforehand are safe — use SetConsent to get an error on invalid names.

func SetConsent

func SetConsent(home, flag string, value bool) error

SetConsent persists one consent flag. It reads the existing config, updates only the consent subkey for the named flag, and writes back atomically. The parent directory (~/.pilot) is created if it does not exist yet.

flag must be one of "telemetry", "broadcasts", or "reviews"; any other value returns a descriptive error and leaves the config file unchanged.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL