Attempt to retrieve a default bridge for the given repo. If zero or multiple bridge exist, it fails.
(repo *cache.RepoCache)
| 131 | // Attempt to retrieve a default bridge for the given repo. If zero or multiple |
| 132 | // bridge exist, it fails. |
| 133 | func DefaultBridge(repo *cache.RepoCache) (*Bridge, error) { |
| 134 | bridges, err := ConfiguredBridges(repo) |
| 135 | if err != nil { |
| 136 | return nil, err |
| 137 | } |
| 138 | |
| 139 | if len(bridges) == 0 { |
| 140 | return nil, fmt.Errorf("no configured bridge") |
| 141 | } |
| 142 | |
| 143 | if len(bridges) > 1 { |
| 144 | return nil, fmt.Errorf("multiple bridge are configured, you need to select one explicitly") |
| 145 | } |
| 146 | |
| 147 | return LoadBridge(repo, bridges[0]) |
| 148 | } |
| 149 | |
| 150 | // ConfiguredBridges return the list of bridge that are configured for the given |
| 151 | // repo |
no test coverage detected