config

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package config provides global configuration for revoco.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the configuration directory path.

func ConfigPath

func ConfigPath() (string, error)

ConfigPath returns the global config file path.

func NormalizeChannel added in v0.1.11

func NormalizeChannel(channel string) string

NormalizeChannel ensures the channel is valid, defaulting to "stable" for unrecognized values.

func Reload

func Reload() error

Reload reloads the global configuration from disk.

func ValidateChannel added in v0.1.11

func ValidateChannel(channel string) error

ValidateChannel validates that the channel is either "stable" or "dev".

Types

type Config

type Config struct {
	// Update settings
	Updates UpdateConfig `json:"updates"`

	// Plugin settings
	Plugins PluginConfig `json:"plugins"`

	// Telemetry settings (for future use)
	Telemetry TelemetryConfig `json:"telemetry,omitempty"`
}

Config holds the global revoco configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration.

func Get

func Get() *Config

Get returns the global configuration, loading it if necessary.

func Load

func Load() (*Config, error)

Load loads the configuration from the default path.

func LoadFrom

func LoadFrom(path string) (*Config, error)

LoadFrom loads the configuration from a specific path.

func (*Config) IsVersionSkipped

func (c *Config) IsVersionSkipped(version string) bool

IsVersionSkipped checks if a version has been skipped.

func (*Config) RecordPluginCheck

func (c *Config) RecordPluginCheck() error

RecordPluginCheck updates the last plugin check timestamp.

func (*Config) RecordUpdateCheck

func (c *Config) RecordUpdateCheck() error

RecordUpdateCheck updates the last update check timestamp.

func (*Config) Save

func (c *Config) Save() error

Save saves the configuration to the default path.

func (*Config) SaveTo

func (c *Config) SaveTo(path string) error

SaveTo saves the configuration to a specific path.

func (*Config) ShouldCheckForPluginUpdates

func (c *Config) ShouldCheckForPluginUpdates() bool

ShouldCheckForPluginUpdates returns true if a plugin update check should be performed.

func (*Config) ShouldCheckForUpdates

func (c *Config) ShouldCheckForUpdates() bool

ShouldCheckForUpdates returns true if an update check should be performed.

func (*Config) SkipVersion

func (c *Config) SkipVersion(version string) error

SkipVersion marks a version as skipped.

type PluginConfig

type PluginConfig struct {
	// AutoUpdate enables automatic plugin updates
	AutoUpdate bool `json:"auto_update"`

	// AutoUpdateInterval is how often to check for plugin updates
	AutoUpdateInterval string `json:"auto_update_interval"`

	// LastPluginCheck is the timestamp of the last plugin update check
	LastPluginCheck time.Time `json:"last_plugin_check,omitempty"`

	// RegistryURL is a custom plugin registry URL
	RegistryURL string `json:"registry_url,omitempty"`
}

PluginConfig holds plugin-related global settings.

type TelemetryConfig

type TelemetryConfig struct {
	// Enabled controls whether anonymous usage data is collected
	Enabled bool `json:"enabled"`

	// MachineID is an anonymous identifier
	MachineID string `json:"machine_id,omitempty"`
}

TelemetryConfig holds telemetry settings.

type UpdateConfig

type UpdateConfig struct {
	// AutoCheck enables automatic update checking on startup
	AutoCheck bool `json:"auto_check"`

	// AutoCheckInterval is how often to check for updates (e.g., "24h")
	AutoCheckInterval string `json:"auto_check_interval"`

	// AutoInstall enables automatic installation of updates
	AutoInstall bool `json:"auto_install"`

	// IncludePrerelease includes pre-release versions in update checks
	IncludePrerelease bool `json:"include_prerelease"`

	// LastCheck is the timestamp of the last update check
	LastCheck time.Time `json:"last_check,omitempty"`

	// SkippedVersion is a version the user chose to skip
	SkippedVersion string `json:"skipped_version,omitempty"`

	// Channel is the update channel (stable, dev)
	Channel string `json:"channel"`
}

UpdateConfig holds update-related settings.

Jump to

Keyboard shortcuts

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