config

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL = "https://api.freelo.io/v1"
)

Variables

This section is empty.

Functions

func GlobalConfigDir

func GlobalConfigDir() string

GlobalConfigDir returns ~/.config/freelo/

func GlobalConfigPath

func GlobalConfigPath() string

GlobalConfigPath returns ~/.config/freelo/config.json

Types

type Config

type Config struct {
	BaseURL   string `json:"base_url,omitempty"`
	Email     string `json:"email,omitempty"`
	ProjectID int    `json:"project_id,omitempty"`
	Format    string `json:"format,omitempty"`
	DevMode   bool   `json:"-"` // Set via --dev flag, not persisted
}

Config holds CLI configuration with multi-layer precedence: flags > env > local > global > defaults

func Load

func Load(dev bool) (*Config, error)

Load reads config from global config file, merges with defaults.

Returns an error rather than calling os.Exit so the caller controls when to bail out — important for `--help` and `version` flows which should keep working even when `--dev` is missing FREELO_DEV_URL.

func (*Config) Save

func (c *Config) Save() error

Save writes config to the global config file.

Jump to

Keyboard shortcuts

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