config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config loads Bindle's host-agnostic connection profiles.

Bindle is never tied to one IBM i host: the host is configuration. Profiles live OUTSIDE any repository (default ~/.bindle/config.json) so credentials are never committed. A resolved profile is assembled from, in increasing precedence: built-in defaults < config file profile < environment < flags.

Index

Constants

View Source
const DefaultPort = 22

DefaultPort is the SSH port assumed when a profile omits one.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() (string, error)

DefaultPath returns ~/.bindle/config.json.

Types

type Config

type Config struct {
	DefaultProfile string             `json:"defaultProfile,omitempty"`
	Profiles       map[string]Profile `json:"profiles,omitempty"`
}

Config is the on-disk ~/.bindle/config.json.

func Load

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

Load reads a config file. A missing file is not an error: it yields an empty config, so Bindle works with env/flags alone.

func (*Config) Resolve

func (c *Config) Resolve(ov Overrides) (*Profile, error)

Resolve assembles the effective profile: defaults < file profile < env < flags. It returns an error if no host or user can be determined.

type Overrides

type Overrides struct {
	Profile   string
	Host      string
	User      string
	Port      int
	Transport string
	KeyFile   string
}

Overrides are values supplied by command-line flags (highest precedence).

type Profile

type Profile struct {
	Host           string `json:"host,omitempty"`
	Port           int    `json:"port,omitempty"`
	User           string `json:"user,omitempty"`
	Transport      string `json:"transport,omitempty"` // "ssh" (default) | "odbc"
	Auth           string `json:"auth,omitempty"`      // "key" (default) | "agent" | "password"
	KeyFile        string `json:"keyFile,omitempty"`
	Password       string `json:"password,omitempty"`
	DefaultLibrary string `json:"defaultLibrary,omitempty"`
}

Profile describes how to reach one IBM i host.

Password is supported for convenience (the file already lives in the user's home, never in a repo), but key or agent auth is preferred. It can always be supplied at runtime via BINDLE_PASSWORD instead of being stored.

Jump to

Keyboard shortcuts

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