config

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config manages the Glean CLI's configuration, providing secure storage of credentials using the system keyring with fallback to file-based storage.

Index

Constants

This section is empty.

Variables

View Source
var ConfigPath string

ConfigPath is the path to the fallback config file.

View Source
var ServiceName = "glean-cli"

ServiceName is the service identifier used for keyring operations.

Functions

func ClearConfig

func ClearConfig() error

ClearConfig removes all stored configuration from both keyring and file storage.

func MaskToken

func MaskToken(token string) string

MaskToken masks a token by showing only the first and last 4 characters and replacing the rest with asterisks.

func NormalizeHost

func NormalizeHost(host string) string

NormalizeHost ensures the Glean host is in the correct format, transforming short names (e.g., "linkedin") to full hostnames (e.g., "linkedin-be.glean.com"). Full hostnames (containing a ".") are returned unchanged.

func SaveConfig

func SaveConfig(host, token string) error

SaveConfig stores host and token in both the system keyring and file storage. It returns an error only if both storage methods fail.

func ValidateAndTransformHost

func ValidateAndTransformHost(host string) (string, error)

ValidateAndTransformHost is a compatibility wrapper around NormalizeHost.

Types

type Config

type Config struct {
	GleanHost         string `json:"host"`
	GleanToken        string `json:"token"`
	OAuthClientID     string `json:"oauth_client_id,omitempty"`
	OAuthClientSecret string `json:"oauth_client_secret,omitempty"`
}

Config holds the Glean API credentials and connection settings.

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig retrieves configuration using the following priority order:

  1. Environment variables (GLEAN_API_TOKEN, GLEAN_HOST)
  2. System keyring
  3. ~/.glean/config.json

Jump to

Keyboard shortcuts

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