config

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 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"`
}

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) 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 MigrationConfig

type MigrationConfig struct {
	Directory string `yaml:"directory" mapstructure:"directory"` // Directory for migration files
}

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