()
| 20 | } |
| 21 | |
| 22 | func (r *profileResolver) refresh() error { |
| 23 | idDirs, err := os.ReadDir(profilesPath) |
| 24 | if err != nil { |
| 25 | return errors.WithMessage(err, "read profiles dir") |
| 26 | } |
| 27 | idDirs = util.RemoveHiddenDirs(idDirs) |
| 28 | envProfile, err := newEnvProfile(config.Current.EnvProfile) |
| 29 | if err == nil { |
| 30 | r.idToProfileMap[envProfile.GetId()] = envProfile |
| 31 | } else if !os.IsNotExist(err) { |
| 32 | return errors.WithMessage(err, "import profile from envvars") |
| 33 | } |
| 34 | for _, idDir := range idDirs { |
| 35 | id := idDir.Name() |
| 36 | profile, err := loadProfile(id) |
| 37 | if err != nil { |
| 38 | log.Fatal().Err(err).Str("id", id).Msg("load profile from files") |
| 39 | } |
| 40 | r.idToProfileMap[id] = profile |
| 41 | } |
| 42 | return nil |
| 43 | } |
| 44 | |
| 45 | func (r *profileResolver) GetAll() ([]Profile, error) { |
| 46 | var profiles []Profile |
nothing calls this directly
no test coverage detected