config

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package config loads ~/.config/local-control-panel/config.toml and resolves the panel's state folder.

Index

Constants

View Source
const AppName = "local-control-panel"

Variables

This section is empty.

Functions

func Dir

func Dir() string

Dir returns $XDG_CONFIG_HOME/local-control-panel, by default ~/.config/local-control-panel.

func StateDir

func StateDir() string

StateDir returns $XDG_STATE_HOME/local-control-panel, by default ~/.local/state/local-control-panel.

Types

type Activity

type Activity struct {
	Active  int `toml:"active"`
	Warm    int `toml:"warm"`
	Dormant int `toml:"dormant"`
}

type Config

type Config struct {
	Root            string             `toml:"root"`
	ScanDepth       int                `toml:"scan_depth"`
	Archive         string             `toml:"archive"`
	Editor          string             `toml:"editor"`
	RefreshSeconds  int                `toml:"refresh_seconds"`
	GitHubUsers     []string           `toml:"github_users"`
	Activity        Activity           `toml:"activity"`
	Runs            RunLogs            `toml:"runs"`
	StateDir        string             `toml:"state_dir"`
	Projects        map[string]Project `toml:"projects"`
	Path            string             `toml:"-"` // file this was loaded from
	CreatedDefaults bool               `toml:"-"` // true when the file was written on this run
	Unknown         []string           `toml:"-"` // keys in the file the panel does not know, e.g. typos
}

func Load

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

Load reads the config file, writing the defaults first if none exists. path overrides the default location; that file must already exist.

func (*Config) IsMine

func (c *Config) IsMine(owner string) bool

IsMine reports whether a remote owner is one of the configured accounts.

func (*Config) Project

func (c *Config) Project(rel string) Project

Project returns the override for a path relative to root.

type Project

type Project struct {
	Dev    []string `toml:"dev"`
	Port   int      `toml:"port"`
	Ignore bool     `toml:"ignore"`
}

type RunLogs

type RunLogs struct {
	Keep     int `toml:"keep"`
	MaxLogMB int `toml:"max_log_mb"`
}

Jump to

Keyboard shortcuts

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