userconfig

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Overview

Package userconfig stores non-secret, per-profile settings that survive between runs: where the OAuth client JSON lives, which account was logged in, and where the refresh token was stored. It lives at os.UserConfigDir()/google-docs-mcp (override with GDOCS_CONFIG_DIR); a non-default profile lives under profiles/<name>/ below that.

Index

Constants

View Source
const AppDir = "google-docs-mcp"

AppDir is the directory name under the user's config directory.

View Source
const DefaultProfile = "default"

DefaultProfile is the profile used when none is named.

View Source
const EnvDir = "GDOCS_CONFIG_DIR"

EnvDir overrides the base directory (tests, unusual setups).

Variables

View Source
var ErrNotFound = errors.New("userconfig: no config file for this profile; run `google-docs-mcp login`")

ErrNotFound is returned when the profile has no config file yet.

Functions

func BaseDir

func BaseDir() (string, error)

BaseDir returns the application config directory.

func DefaultClientSecretPath

func DefaultClientSecretPath(profile string) (string, error)

DefaultClientSecretPath is where `login` looks for the OAuth client JSON when no path is given.

func Path

func Path(profile string) (string, error)

Path returns the config file path for the profile.

func ProfileDir

func ProfileDir(profile string) (string, error)

ProfileDir returns the directory holding one profile's files.

func Remove

func Remove(profile string) error

Remove deletes the profile's config file. Missing files are not an error.

func Save

func Save(profile string, c Config) error

Save writes the profile's config with owner-only permissions.

func TokenFilePath

func TokenFilePath(profile string) (string, error)

TokenFilePath is the plaintext fallback location for the refresh token.

Types

type Config

type Config struct {
	ClientSecretPath string    `json:"client_secret_path,omitempty"`
	AccountEmail     string    `json:"account_email,omitempty"`
	TokenStore       string    `json:"token_store,omitempty"`
	Scopes           []string  `json:"scopes,omitempty"`
	UpdatedAt        time.Time `json:"updated_at"`
}

Config is the stored, non-secret profile state.

func Load

func Load(profile string) (Config, error)

Load reads the profile's config. ErrNotFound if absent.

Jump to

Keyboard shortcuts

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