config

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigFileFolder = ".moley"
)

Variables

This section is empty.

Functions

func GetConfigFilePath

func GetConfigFilePath() (string, error)

GetConfigFilePath returns the full path to the config file

func GetConfigFolderPath

func GetConfigFolderPath() (string, error)

GetConfigFolderPath returns the path to the config folder

func SaveMoleyConfigToFile

func SaveMoleyConfigToFile(cfg *MoleyConfig) error

SaveMoleyConfigToFile saves the Moley configuration to file

Types

type CloudflareConfig

type CloudflareConfig struct {
	Token string `mapstructure:"token" yaml:"token"`
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager provides a simple way to manage global configuration

func GetManager

func GetManager() *Manager

GetManager returns the singleton config manager instance

func (*Manager) Get

func (m *Manager) Get() *MoleyConfig

Get returns the cached configuration

func (*Manager) Load

func (m *Manager) Load() error

Load loads the configuration from file and caches it

func (*Manager) Save

func (m *Manager) Save() error

Save saves the current configuration to file

func (*Manager) Set

func (m *Manager) Set(config *MoleyConfig)

Set updates the cached configuration

type MoleyConfig

type MoleyConfig struct {
	Cloudflare CloudflareConfig `mapstructure:"cloudflare" yaml:"cloudflare"`
}

func LoadFromFlags

func LoadFromFlags(cmd *cobra.Command) (*MoleyConfig, error)

LoadFromFlags loads configuration from command line flags

func LoadMoleyConfig

func LoadMoleyConfig() (*MoleyConfig, error)

LoadMoleyConfig loads the global Moley configuration from the user's home directory

func NewConfig

func NewConfig() *MoleyConfig

NewConfig creates a new Config instance with default values

Jump to

Keyboard shortcuts

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