config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOrUpdateProfile

func AddOrUpdateProfile(p Profile, testConnection func(Profile) error) error

func BuildDSN

func BuildDSN(p Profile) string

func DeleteProfile

func DeleteProfile(name string) error

func ProfileExists

func ProfileExists(name string) (bool, error)

func SaveConfig

func SaveConfig(cfg *ConfigFile) error

SaveConfig writes the YAML configuration file to disk.

func SetActiveProfile

func SetActiveProfile(name string) error

Types

type ConfigFile

type ConfigFile struct {
	ActiveProfile string             `yaml:"active_profile,omitempty"`
	Profiles      map[string]Profile `yaml:"profiles"`
}

func ListProfiles

func ListProfiles() (*ConfigFile, error)

func LoadConfig

func LoadConfig() (*ConfigFile, error)

LoadConfig reads ~/.pgtransfer/config.yaml or initializes a new one.

type Profile

type Profile struct {
	Name     string    `yaml:"name"`
	User     string    `yaml:"user,omitempty"`
	Password string    `yaml:"password,omitempty"`
	Host     string    `yaml:"host,omitempty"`
	Port     int       `yaml:"port,omitempty"`
	Database string    `yaml:"database,omitempty"`
	SSLMode  string    `yaml:"sslmode,omitempty"`
	DBURL    string    `yaml:"dburl,omitempty"`
	SSH      SSHConfig `yaml:"ssh,omitempty"`
}

func GetActiveProfile

func GetActiveProfile() (Profile, error)

type SSHConfig

type SSHConfig struct {
	Enabled    bool   `yaml:"enabled"`
	User       string `yaml:"user,omitempty"`
	Host       string `yaml:"host,omitempty"`
	Port       int    `yaml:"port,omitempty"`
	KeyPath    string `yaml:"key_path,omitempty"`
	Passphrase string `yaml:"passphrase,omitempty"`
	Password   string `yaml:"password,omitempty"`
	Timeout    int    `yaml:"timeout,omitempty"`
}

Jump to

Keyboard shortcuts

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