create config package
This commit is contained in:
parent
9b0597e680
commit
de0a3b3e85
20
config/config.go
Normal file
20
config/config.go
Normal file
@ -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"),
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user