localconfig

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package localconfig knows where AgentGuard keeps its files for the current user: the config folder (starter policy, API key, what `agentguard setup` set up) and the data folder setup creates for the audit log and state database. The config folder is the one the installers write the starter policy to (scripts/install.sh, scripts/install.ps1), so every piece agrees on it.

Functions take the OS as a parameter so tests can check every layout from any machine.

Index

Constants

View Source
const (
	PolicyFile = "default.yaml"
	APIKeyFile = "api-key"
	SetupFile  = "setup.json"
)

Names of the files in the config folder.

Variables

This section is empty.

Functions

func APIKeyPath

func APIKeyPath(goos string) string

APIKeyPath is the file `agentguard setup` saves the server's API key in.

func ConfigDir

func ConfigDir(goos string) string

ConfigDir is the user's AgentGuard config folder: $XDG_CONFIG_HOME/agentguard (else ~/.config/agentguard, on macOS too, like the installer), or %APPDATA%\agentguard on Windows. Empty when the home folder is unknown.

func DataDir

func DataDir(goos string) string

DataDir is where `agentguard setup` keeps the audit log, the state database and the server log: $XDG_DATA_HOME/agentguard (else ~/.local/share/agentguard), or %LOCALAPPDATA%\AgentGuard\data on Windows.

func FirstLine

func FirstLine(b []byte) string

FirstLine is the first line of b without surrounding whitespace: how a key file is read, so a trailing newline from an editor doesn't count.

func ReadAPIKey

func ReadAPIKey(goos string) string

ReadAPIKey returns the key saved by `agentguard setup`, or "" when there is none. Client commands fall back to it when neither --api-key nor AGENTGUARD_API_KEY is set; the server never reads it implicitly (a key changes which interfaces it listens on), only through --api-key-file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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