feat: passthrough proxies
This commit is contained in:
@ -2,6 +2,7 @@ package layer
|
||||
|
||||
import (
|
||||
"os"
|
||||
"slices"
|
||||
|
||||
"forge.cadoles.com/cadoles/bouncer/internal/client"
|
||||
"forge.cadoles.com/cadoles/bouncer/internal/command/admin/apierr"
|
||||
@ -52,14 +53,16 @@ func QueryCommand() *cli.Command {
|
||||
|
||||
client := client.New(baseFlags.ServerURL, client.WithToken(token))
|
||||
|
||||
proxies, err := client.QueryLayer(ctx.Context, proxyName, options...)
|
||||
layers, err := client.QueryLayer(ctx.Context, proxyName, options...)
|
||||
if err != nil {
|
||||
return errors.WithStack(apierr.Wrap(err))
|
||||
}
|
||||
|
||||
slices.SortFunc(layers, sortLayerssByWeight)
|
||||
|
||||
hints := layerHeaderHints(baseFlags.OutputMode)
|
||||
|
||||
if err := format.Write(baseFlags.Format, os.Stdout, hints, clientFlag.AsAnySlice(proxies)...); err != nil {
|
||||
if err := format.Write(baseFlags.Format, os.Stdout, hints, clientFlag.AsAnySlice(layers)...); err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
@ -67,3 +70,13 @@ func QueryCommand() *cli.Command {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func sortLayerssByWeight(a *store.LayerHeader, b *store.LayerHeader) int {
|
||||
if a.Weight < b.Weight {
|
||||
return 1
|
||||
}
|
||||
if a.Weight > b.Weight {
|
||||
return -1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
Reference in New Issue
Block a user