CurrentAppConfig returns the currently active app config. Resolution priority: profileOverride > CurrentApp field > Apps[0].
(profileOverride string)
| 68 | // CurrentAppConfig returns the currently active app config. |
| 69 | // Resolution priority: profileOverride > CurrentApp field > Apps[0]. |
| 70 | func (m *MultiAppConfig) CurrentAppConfig(profileOverride string) *AppConfig { |
| 71 | if profileOverride != "" { |
| 72 | if app := m.FindApp(profileOverride); app != nil { |
| 73 | return app |
| 74 | } |
| 75 | return nil |
| 76 | } |
| 77 | if m.CurrentApp != "" { |
| 78 | if app := m.FindApp(m.CurrentApp); app != nil { |
| 79 | return app |
| 80 | } |
| 81 | return nil // explicit currentApp not found; don't silently fallback |
| 82 | } |
| 83 | if len(m.Apps) > 0 { |
| 84 | return &m.Apps[0] |
| 85 | } |
| 86 | return nil |
| 87 | } |
| 88 | |
| 89 | // FindApp looks up an app by name, then by appId. Returns nil if not found. |
| 90 | // Name match takes priority: if profile A has Name "X" and profile B has AppId "X", |