config

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package config provides configuration management for the mink CLI.

Index

Constants

View Source
const ConfigFileName = "mink.yaml"

ConfigFileName is the default config file name

Variables

This section is empty.

Functions

func Exists

func Exists(dir string) bool

Exists checks if a config file exists in the directory

func GenerateYAML

func GenerateYAML(cfg *Config) string

GenerateYAML generates YAML content with comments

Types

type Config

type Config struct {
	// Version of the config file format
	Version string `yaml:"version"`

	// Project configuration
	Project ProjectConfig `yaml:"project"`

	// Database configuration
	Database DatabaseConfig `yaml:"database"`

	// EventStore configuration
	EventStore EventStoreConfig `yaml:"event_store"`

	// Generation configuration
	Generation GenerationConfig `yaml:"generation"`
}

Config represents the mink CLI configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default configuration

func FindConfig

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

FindConfig searches for a config file starting from dir and going up

func Load

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

Load loads configuration from the specified directory

func LoadFile

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

LoadFile loads configuration from a specific file path

func (*Config) Save

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

Save saves the configuration to the specified directory

func (*Config) SaveFile

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

SaveFile saves the configuration to a specific file path

func (*Config) Validate

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

Validate validates the configuration

type DatabaseConfig

type DatabaseConfig struct {
	// Driver is the database driver (postgres, memory)
	Driver string `yaml:"driver"`

	// URL is the database connection string
	URL string `yaml:"url,omitempty"`

	// Schema is the database schema to use
	Schema string `yaml:"schema"`

	// MigrationsDir is the directory for migration files
	MigrationsDir string `yaml:"migrations_dir"`
}

DatabaseConfig contains database connection settings

type EventStoreConfig

type EventStoreConfig struct {
	// TableName for events
	TableName string `yaml:"table_name"`

	// SnapshotTableName for snapshots
	SnapshotTableName string `yaml:"snapshot_table_name"`

	// OutboxTableName for outbox messages
	OutboxTableName string `yaml:"outbox_table_name"`
}

EventStoreConfig contains event store settings

type GenerationConfig

type GenerationConfig struct {
	// AggregatePackage is the package for aggregates
	AggregatePackage string `yaml:"aggregate_package"`

	// EventPackage is the package for events
	EventPackage string `yaml:"event_package"`

	// ProjectionPackage is the package for projections
	ProjectionPackage string `yaml:"projection_package"`

	// CommandPackage is the package for commands
	CommandPackage string `yaml:"command_package"`
}

GenerationConfig contains code generation settings

type ProjectConfig

type ProjectConfig struct {
	// Name of the project
	Name string `yaml:"name"`

	// Module is the Go module path
	Module string `yaml:"module"`

	// SourceDir is the root source directory
	SourceDir string `yaml:"source_dir"`
}

ProjectConfig contains project-level settings

Jump to

Keyboard shortcuts

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