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 ¶
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 ¶
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.