config

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config is the OpenObserve config-file model shared by the CLI and the desktop GUI: the on-disk YAML schema (named contexts + current context + shared defaults), file IO, and context helpers. Secrets are never stored here; they live in the OS keychain. The CLI's layered loader (flags/env/file) builds on this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigFilePath

func ConfigFilePath(dir string) string

ConfigFilePath returns the YAML config file path inside dir.

func DefaultConfigDir

func DefaultConfigDir() (string, error)

DefaultConfigDir returns the per-user config directory (~/.angelmsger/openobserve).

func ResolveConfigDir

func ResolveConfigDir() (string, error)

ResolveConfigDir picks the config directory to use when --config was not supplied.

func WriteFile

func WriteFile(dir string, f File) error

WriteFile persists a File to dir/config.yaml, creating dir with 0700 permissions. Secrets are never written here.

Types

type AuthConfig

type AuthConfig struct {
	Scheme   string `yaml:"scheme"`
	Username string `yaml:"username,omitempty"`
}

AuthConfig is the per-context auth settings persisted to the file.

type Defaults

type Defaults struct {
	Format     string        `yaml:"format"`
	Timeout    time.Duration `yaml:"timeout"`
	MaxRetries int           `yaml:"max_retries"`
	ReadOnly   bool          `yaml:"read_only,omitempty"`
}

Defaults are runtime defaults shared across contexts.

type File

type File struct {
	CurrentContext string
	Contexts       []NamedContext
	Defaults       Defaults
}

File is the parsed config file: named contexts plus shared defaults and the name of the current context.

func ReadFile

func ReadFile(dir string) (File, bool, error)

ReadFile reads and parses the config file in dir. The bool return is false when the file does not exist.

func (File) Context

func (f File) Context(name string) (NamedContext, bool)

Context returns the context whose name matches, case-insensitively.

func (File) ContextNames

func (f File) ContextNames() []string

ContextNames returns every context name, in file order.

func (*File) Remove

func (f *File) Remove(name string) bool

Remove deletes the context with the given (case-insensitive) name, preserving order. It reports whether a context was removed.

func (*File) Upsert

func (f *File) Upsert(nc NamedContext)

Upsert inserts or replaces a context by case-insensitive name, preserving file order for existing entries.

type NamedContext

type NamedContext struct {
	Name    string
	BaseURL string
	Org     string
	Auth    AuthConfig
}

NamedContext is one named OpenObserve server profile inside the config file.

Jump to

Keyboard shortcuts

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