diff --git a/configs/main.go b/configs/main.go index a2725ec98..e262a8da1 100644 --- a/configs/main.go +++ b/configs/main.go @@ -2,7 +2,6 @@ package configs import ( "os" - "os/user" "path" "path/filepath" "reflect" @@ -66,25 +65,6 @@ func (c *Configs) marshalConfig(config *Config, cfg interface{}) error { return err } -func fetchHomeDir() (homeDir *string, err error) { - // In OSX BigSur, or terminals where the user isn't set - // user.Current cannot function - // As a backstop (We should be crosscompiling using clang) - // hoist the dirhir from env - defer func() { - if r := recover(); r != nil { - home := os.Getenv("HOME") - homeDir = &home - err = nil - } - }() - user, err := user.Current() - if err != nil { - return nil, err - } - return &user.HomeDir, nil -} - func New() *Configs { // Configs stored in projects (/.railway) // Includes projectId, environmentId, etc @@ -110,11 +90,7 @@ func New() *Configs { // Configs stored in root (~/.railway) // Includes token, etc userViper := viper.New() - homeDir, err := fetchHomeDir() - if err != nil { - panic(err) - } - userPath := path.Join(*homeDir, ".railway/config.json") + userPath := path.Join(os.Getenv("HOME"), ".railway/config.json") userViper.SetConfigFile(userPath) userViper.ReadInConfig()