@@ -32,13 +32,8 @@ import (
3232
3333func sanitizeLocalhost (host string , mode string ) (string , error ) {
3434 _host := host
35- if strings .HasPrefix (_host , "https://" ) {
36- _host = _host [len ("https://" ):]
37- }
38- if strings .HasPrefix (_host , "http://" ) {
39- _host = _host [len ("http://" ):]
40- }
41-
35+ _host = strings .TrimPrefix (_host , "https:" )
36+ _host = strings .TrimPrefix (_host , "http:" )
4237 _host = strings .Trim (_host , "/" )
4338
4439 if len (_host ) == 0 {
@@ -107,7 +102,7 @@ func parseFlags(cmd *cobra.Command) (*Options, error) {
107102 _keys , _ := cmd .Flags ().GetStringSlice ("metadata-keys" )
108103 switch l := len (_keys ); {
109104 case l == 0 :
110- return nil , fmt . Errorf ( "no metadata keys provided" )
105+ // nothing to do... allow to take all metadata
111106 case l > 1 :
112107 log .Warn ().Msg ("multiple metadata keys are not supported yet, only the first one will be used" )
113108 fallthrough
@@ -210,9 +205,6 @@ func createOpenapiEvent(endp *opsr.Endpoint, srv *opsr.Service, eventType string
210205}
211206
212207func mapContainsKeys (subject map [string ]string , targets []string ) bool {
213- // TODO: this will be useful for other commands as well, so it will be
214- // put in a sort of utils package
215-
216208 foundKeys := 0
217209 for _ , targetKey := range targets {
218210 if _ , exists := subject [targetKey ]; exists {
0 commit comments