config

package
v1.14.2 Latest Latest
Warning

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

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

Documentation

Overview

Package config provides configuration loading and management for makemigrations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigPath

func GetConfigPath() string

GetConfigPath returns the default config file path

Types

type Config

type Config struct {
	// Database configuration
	Database DatabaseConfig `yaml:"database" mapstructure:"database"`

	// Migration settings
	Migration MigrationConfig `yaml:"migration" mapstructure:"migration"`

	// Output settings
	Output OutputConfig `yaml:"output" mapstructure:"output"`

	// Schema includes discovered by find-includes
	Includes []IncludeEntry `yaml:"includes,omitempty" mapstructure:"includes"`
}

Config represents the morphic configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func Load

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

Load loads configuration from file and environment variables

func LoadOrDefault

func LoadOrDefault(configPath string) *Config

LoadOrDefault loads configuration or returns default if not found

func (*Config) AddInclude added in v1.14.0

func (c *Config) AddInclude(module, path string) bool

AddInclude adds a new include entry if it doesn't already exist. Returns true if the entry was added, false if it already existed.

func (*Config) HasInclude added in v1.14.0

func (c *Config) HasInclude(module, path string) bool

HasInclude checks if a module+path combination is already in the includes list

func (*Config) Save

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

Save saves the configuration to a file

type DatabaseConfig

type DatabaseConfig struct {
	Type       string `yaml:"type" mapstructure:"type"`               // postgresql, mysql, sqlserver, sqlite
	DefaultURL string `yaml:"default_url" mapstructure:"default_url"` // Fallback database URL when DATABASE_URL env var is not set
}

DatabaseConfig contains database-related settings

type IncludeEntry added in v1.14.0

type IncludeEntry struct {
	Module string `yaml:"module" mapstructure:"module"`
	Path   string `yaml:"path" mapstructure:"path"`
}

IncludeEntry represents an external schema module to include

type MigrationConfig

type MigrationConfig struct {
	Directory string `yaml:"directory" mapstructure:"directory"` // Directory for migration files
	Format    string `yaml:"format" mapstructure:"format"`       // Output format: go or starlark
}

MigrationConfig contains migration-related settings

type OutputConfig

type OutputConfig struct {
	Verbose      bool `yaml:"verbose" mapstructure:"verbose"`             // Enable verbose output
	ColorEnabled bool `yaml:"color_enabled" mapstructure:"color_enabled"` // Enable colored output
}

OutputConfig contains output formatting settings

Jump to

Keyboard shortcuts

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