config

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath() string

ConfigPath returns the full path to the config file. Checks system-wide path first (for Windows Service), then user home.

func CopyToSystemPath added in v0.2.1

func CopyToSystemPath() error

CopyToSystemPath copies the user config to the system-wide path. This is needed for Windows Services which run as LOCAL SYSTEM.

func Exists

func Exists() bool

Exists checks if a config file exists.

func Save

func Save(cfg *AgentConfig) error

Save writes the config to disk atomically (write to .tmp, then rename).

func SystemConfigPath added in v0.2.1

func SystemConfigPath() string

SystemConfigPath returns the system-wide config path. On Windows: %PROGRAMDATA%\NerdBackup\config.json On Linux/macOS: /etc/nerdbackup/config.json

func UserConfigPath added in v0.2.1

func UserConfigPath() string

UserConfigPath returns the user-specific config path (always in home dir).

Types

type AgentConfig

type AgentConfig struct {
	AgentID          string    `json:"agent_id"`
	AgentToken       string    `json:"agent_token"`
	APIBaseURL       string    `json:"api_base_url"`
	Name             string    `json:"name"`
	Debug            bool      `json:"debug"`
	InitializedRepos []string  `json:"initialized_repos,omitempty"`
	LastETag         string    `json:"last_etag,omitempty"`
	LastBackupAt     string    `json:"last_backup_at,omitempty"`
	StartedAt        time.Time `json:"started_at,omitempty"`
}

AgentConfig is the persistent agent configuration stored locally.

func Load

func Load() (*AgentConfig, error)

Load reads the config from disk.

func (*AgentConfig) IsRepoInitialized

func (c *AgentConfig) IsRepoInitialized(repoID string) bool

IsRepoInitialized checks if a repo has been initialized before.

func (*AgentConfig) MarkRepoInitialized

func (c *AgentConfig) MarkRepoInitialized(repoID string)

MarkRepoInitialized adds a repo to the initialized list.

Jump to

Keyboard shortcuts

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