config

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Discover

func Discover(startDir string) (string, error)

Discover walks up from the given directory to find a .bruin.yml file.

Types

type Config

type Config struct {
	DefaultEnvironment string                 `yaml:"default_environment"`
	Environments       map[string]Environment `yaml:"environments"`
}

Config represents the .bruin.yml configuration file.

func Load

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

Load reads and parses a .bruin.yml file from the given path.

func (*Config) GetEnvironment

func (c *Config) GetEnvironment(name string) (*Environment, error)

GetEnvironment returns the named environment, or the default one.

func (*Config) Save

func (c *Config) Save(path string) error

Save writes the config back to a YAML file at the given path.

type Connection

type Connection struct {
	Name string `yaml:"name"`
	// Extra holds all other fields (host, port, database, etc.).
	Extra map[string]any `yaml:",inline"`
}

Connection is a generic connection entry. Different connection types have different fields, but they all share a name. We use a map for the rest since .bruin.yml supports dozens of connection types.

type Environment

type Environment struct {
	SchemaPrefix string                  `yaml:"schema_prefix,omitempty"`
	Connections  map[string][]Connection `yaml:"connections"`
}

func (*Environment) FindConnection

func (e *Environment) FindConnection(name string) (*Connection, error)

FindConnection looks up a connection by name across all connection types in an environment.

Jump to

Keyboard shortcuts

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