ketotrack/config/config.go

21 lines
395 B
Go
Raw Normal View History

2024-05-12 19:46:06 +00:00
package config
import (
"os"
"path/filepath"
)
type AppConfig struct {
DataPath string
}
func Load() AppConfig {
// TODO: Handle os.MkdirAll error gracefully
homeDir, _ := os.UserHomeDir()
ketotrackDir := filepath.Join(homeDir, ".ketotrack")
os.MkdirAll(ketotrackDir, 0770) // handle error appropriately
return AppConfig{
DataPath: filepath.Join(ketotrackDir, "records.json"),
}
}