Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var LoadConfig = func(configFile string) error { configPaths := []string{} if configFile == "" { defaultConfig := "spage.yaml" if _, err := os.Stat(defaultConfig); err == nil { configPaths = append(configPaths, defaultConfig) } } else { configPaths = append(configPaths, configFile) } var err error cfg, err = config.Load(configPaths...) if err != nil { if configFile != "" || !os.IsNotExist(err) { return fmt.Errorf("failed to load configuration from %v: %w", configPaths, err) } cfg, err = config.Load() if err != nil { return fmt.Errorf("failed to load default configuration: %w", err) } } common.SetLogLevel(cfg.Logging.Level) if cfg.Logging.File != "" { if err := common.SetLogFile(cfg.Logging.File); err != nil { return fmt.Errorf("error setting log file: %w", err) } } if err := common.SetLogFormat(cfg.Logging); err != nil { return fmt.Errorf("error setting log format: %w", err) } return nil }
LoadConfig loads the configuration and applies settings
View Source
var RootCmd = &cobra.Command{ Use: "spage", Short: "Simple Playbook AGEnt", Long: `A lightweight configuration management tool that compiles your playbooks into a Go program to run on a host.`, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { return LoadConfig(configFile) }, }
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.