21 lines
395 B
Go
21 lines
395 B
Go
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"),
|
|
}
|
|
}
|