diff --git a/config/config.go b/config/config.go new file mode 100644 index 0000000..46eb8ca --- /dev/null +++ b/config/config.go @@ -0,0 +1,20 @@ +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"), + } +}