disable logging
This commit is contained in:
parent
df6679edf5
commit
7cb2ac3e8f
3 changed files with 2 additions and 2 deletions
|
|
@ -1,32 +0,0 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
gemlog "git.travisshears.com/travisshears/gemlog-cli/gemlog"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
// LoadConfig reads and parses the YAML configuration file from ~/.config/gemlog-cli
|
||||
func LoadConfig() (*gemlog.Config, error) {
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get user home directory: %w", err)
|
||||
}
|
||||
|
||||
configPath := filepath.Join(homeDir, ".config", "gemlog-cli", "config.yml")
|
||||
|
||||
data, err := os.ReadFile(configPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read config file %s: %w", configPath, err)
|
||||
}
|
||||
|
||||
var config gemlog.Config
|
||||
if err := yaml.Unmarshal(data, &config); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse YAML config: %w", err)
|
||||
}
|
||||
|
||||
return &config, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue