config

package
v1.8.5 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

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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