config

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigPath added in v1.4.3

func GetConfigPath(system bool) (string, error)

GetConfigPath returns the full path for the configuration file.

func LoadConfig

func LoadConfig[T any](cmd *cobra.Command, defaults map[string]any, additional_config_file_path *string) (T, error)

func Save added in v1.4.3

func Save() error

Save persists the current Viper configuration to the user's config file. It unmarshals the current state into the Config struct to ensure the file structure (e.g., nested database keys) is preserved.

func WriteConfigFile

func WriteConfigFile[T any](c *T, system bool) error

Types

type Config added in v1.4.3

type Config struct {
	Database struct {
		Type string `mapstructure:"type"`
		Dsn  string `mapstructure:"dsn"`
	} `mapstructure:"database"`
	Language string `mapstructure:"language"`
}

Config holds the application's configuration, loaded from file/env/flags.

Jump to

Keyboard shortcuts

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