config

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindProjectRoot

func FindProjectRoot(start string) (string, error)

Types

type API

type API struct {
	BaseURL  string            `toml:"base_url"`
	Spec     string            `toml:"spec"`
	Auth     string            `toml:"auth"`
	AuthType string            `toml:"auth_type"`
	Headers  map[string]string `toml:"headers"`

	ResolvedBaseURL string `toml:"-"`
	ResolvedAuth    string `toml:"-"`
}

type APIOverride added in v0.25.0

type APIOverride struct {
	BaseURL  *string           `toml:"base_url,omitempty"`
	Auth     *string           `toml:"auth,omitempty"`
	AuthType *string           `toml:"auth_type,omitempty"`
	Headers  map[string]string `toml:"headers,omitempty"`
}

APIOverride contains optional overrides for the API section.

type Commands

type Commands map[string]string

type Config

type Config struct {
	Database *Database `toml:"database"`
	API      *API      `toml:"api"`
	GRPC     *GRPC     `toml:"grpc"`
	Log      *Log      `toml:"log"`
	Plugin   *Plugin   `toml:"plugin"`
	Commands Commands  `toml:"commands"`
	Envs     Envs      `toml:"envs"`
	// contains filtered or unexported fields
}

func Load

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

Load reads and parses the tinker.toml configuration file. Environment overrides are NOT applied — use LoadWithEnv for that.

func LoadWithEnv added in v0.25.0

func LoadWithEnv(dir string, envName string) (*Config, error)

LoadWithEnv reads and parses the tinker.toml configuration file, then applies overrides for the specified environment (e.g., "staging", "production"). An empty envName means use the base configuration without overrides.

func (*Config) ApplyEnv added in v0.25.0

func (c *Config) ApplyEnv(envName string)

ApplyEnv applies environment overrides to the base config. Only non-nil fields in the override are applied; zero-value fields are left unchanged.

func (*Config) GetEnvVars added in v0.19.0

func (c *Config) GetEnvVars() map[string]string

GetEnvVars returns the stored .env variables.

func (*Config) ListEnvs added in v0.25.0

func (c *Config) ListEnvs() []string

ListEnvs returns the list of available environment names.

func (*Config) Resolve

func (c *Config) Resolve() error

func (*Config) SetEnvVars added in v0.19.0

func (c *Config) SetEnvVars(env map[string]string)

SetEnvVars stores the parsed .env variables on the config.

func (*Config) Validate added in v0.19.0

func (c *Config) Validate() []string

Validate checks the configuration for common issues and returns all problems found.

type Database

type Database struct {
	Source     string `toml:"source"`
	Type       string `toml:"type"`
	Driver     string `toml:"driver"`
	MigrateDir string `toml:"migrate_dir"`
	SeedDir    string `toml:"seed_dir"`
	URL        string `toml:"-"`
}

type DatabaseOverride added in v0.25.0

type DatabaseOverride struct {
	Source *string `toml:"source,omitempty"`
	Type   *string `toml:"type,omitempty"`
	Driver *string `toml:"driver,omitempty"`
}

DatabaseOverride contains optional overrides for the database section.

type EnvOverrides added in v0.25.0

type EnvOverrides struct {
	Database *DatabaseOverride `toml:"database,omitempty"`
	API      *APIOverride      `toml:"api,omitempty"`
	GRPC     *GRPCOverride     `toml:"grpc,omitempty"`
}

EnvOverrides represents per-environment configuration overrides. Only non-nil fields are applied on top of the base config.

type Envs added in v0.25.0

type Envs map[string]EnvOverrides

Envs holds multi-environment configuration overrides. Each key is an environment name (e.g., "staging", "production"), and the value is a partial Config that overrides the base config.

type GRPC

type GRPC struct {
	Addr       string `toml:"addr"`
	ProtoDir   string `toml:"proto_dir"`
	Reflection bool   `toml:"reflection"`

	ResolvedAddr string `toml:"-"`
}

type GRPCOverride added in v0.25.0

type GRPCOverride struct {
	Addr       *string `toml:"addr,omitempty"`
	ProtoDir   *string `toml:"proto_dir,omitempty"`
	Reflection *bool   `toml:"reflection,omitempty"`
}

GRPCOverride contains optional overrides for the gRPC section.

type Log added in v0.14.0

type Log struct {
	Files []string `toml:"files"`
}

type Plugin added in v0.28.0

type Plugin struct {
	// Dir is the directory containing script plugins (default: "plugins")
	Dir string `toml:"dir"`
	// Enabled controls whether the plugin system is active (default: true)
	Enabled bool `toml:"enabled"`
}

Plugin holds plugin system configuration.

Jump to

Keyboard shortcuts

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