config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDir

func DefaultDir() string

DefaultDir returns Bucky's default config directory.

func DefaultFilePath

func DefaultFilePath() string

DefaultFilePath returns Bucky's default config file path.

Types

type Config

type Config struct {
	Theme      string     `mapstructure:"theme"`       // "dark", "light", "auto"
	SortBy     string     `mapstructure:"sort_by"`     // "name", "size", "date" — default "name"
	SortOrder  string     `mapstructure:"sort_order"`  // "asc" or "desc" — default "asc"
	ShowHidden bool       `mapstructure:"show_hidden"` // default false
	Sync       SyncConfig `mapstructure:"sync"`
	Profiles   []Profile  `mapstructure:"profiles"`
	SourcePath string     `mapstructure:"-"`
}

Config holds the application configuration.

func Load

func Load() (*Config, error)

Load reads configuration from ~/.config/bucky/config.toml and auto-discovers AWS profiles from ~/.aws/credentials.

func LoadFrom

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

LoadFrom reads configuration from the given directory. Supports both legacy [[profiles]] arrays and new [profile.<name>] tables. Does NOT auto-discover AWS profiles (use Load for that).

func (*Config) DefaultProfile

func (c *Config) DefaultProfile() (Profile, error)

DefaultProfile returns the first profile, or an error if none exist.

func (*Config) ProfileByName

func (c *Config) ProfileByName(name string) (Profile, error)

ProfileByName returns the profile with the given name, or an error if not found.

type Profile

type Profile struct {
	Name   string `mapstructure:"name"`
	Type   string `mapstructure:"type"`
	Prefix string `mapstructure:"prefix"`

	// S3 fields
	Bucket    string `mapstructure:"bucket"`
	Region    string `mapstructure:"region"`
	AccessKey string `mapstructure:"access_key"`
	SecretKey string `mapstructure:"secret_key"`
	Endpoint  string `mapstructure:"endpoint"`

	// AWS shared credentials fields
	AWSProfile         string `mapstructure:"aws_profile"`
	AWSCredentialsFile string `mapstructure:"aws_credentials_file"`
	AWSConfigFile      string `mapstructure:"aws_config_file"`

	// GCS fields
	ProjectID          string `mapstructure:"project_id"`
	GCPCredentialsFile string `mapstructure:"gcp_credentials_file"`
	GCPUseADC          *bool  `mapstructure:"gcp_use_adc"` // pointer so we can detect unset vs false; default true

	// SFTP fields
	Host                  string `mapstructure:"host"`
	Port                  int    `mapstructure:"port"` // default 22
	Username              string `mapstructure:"username"`
	Password              string `mapstructure:"password"`
	PrivateKeyPath        string `mapstructure:"private_key_path"`
	PrivateKeyPassphrase  string `mapstructure:"private_key_passphrase"`
	KnownHostsPath        string `mapstructure:"known_hosts_path"`
	InsecureIgnoreHostKey bool   `mapstructure:"insecure_ignore_host_key"`
}

Profile represents a connection profile from the config file.

type SyncConfig

type SyncConfig struct {
	DryRunDefault      *bool  `mapstructure:"dry_run_default"`
	CompareMode        string `mapstructure:"compare_mode"` // "mtime_size", "size_only", "exact_timestamps"
	DeleteDefault      bool   `mapstructure:"delete_default"`
	NoOverwriteDefault bool   `mapstructure:"no_overwrite_default"`
	Concurrency        int    `mapstructure:"concurrency"` // default 4
}

SyncConfig holds optional defaults for sync setup.

Jump to

Keyboard shortcuts

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