File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import (
30
30
31
31
"github.com/falcosecurity/falcoctl/internal/config"
32
32
"github.com/falcosecurity/falcoctl/internal/login/basic"
33
+ "github.com/falcosecurity/falcoctl/internal/utils"
33
34
"github.com/falcosecurity/falcoctl/pkg/oci/authn"
34
35
"github.com/falcosecurity/falcoctl/pkg/options"
35
36
"github.com/falcosecurity/falcoctl/pkg/output"
@@ -95,8 +96,15 @@ Example - Login with username and password in an interactive prompt:
95
96
96
97
// RunBasic executes the business logic for the basic command.
97
98
func (o * loginOptions ) RunBasic (ctx context.Context , args []string ) error {
98
- reg := args [ 0 ]
99
+ var reg string
99
100
logger := o .Printer .Logger
101
+
102
+ // Allow to have the registry expressed as a ref, but actually extract it.
103
+ reg , err := utils .GetRegistryFromRef (args [0 ])
104
+ if err != nil {
105
+ reg = args [0 ]
106
+ }
107
+
100
108
if err := getCredentials (o .Printer , o ); err != nil {
101
109
return err
102
110
}
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import (
30
30
"github.com/mitchellh/mapstructure"
31
31
"github.com/spf13/viper"
32
32
33
+ "github.com/falcosecurity/falcoctl/internal/utils"
33
34
drivertype "github.com/falcosecurity/falcoctl/pkg/driver/type"
34
35
"github.com/falcosecurity/falcoctl/pkg/oci"
35
36
)
@@ -395,8 +396,14 @@ func basicAuthListHookFunc() mapstructure.DecodeHookFuncType {
395
396
return data , fmt .Errorf ("not valid token %q" , token )
396
397
}
397
398
399
+ // Allow to have the registry expressed as a ref, but actually extract it.
400
+ registry , err := utils .GetRegistryFromRef (values [0 ])
401
+ if err != nil {
402
+ registry = values [0 ]
403
+ }
404
+
398
405
auths [i ] = BasicAuth {
399
- Registry : values [ 0 ] ,
406
+ Registry : registry ,
400
407
User : values [1 ],
401
408
Password : values [2 ],
402
409
}
You can’t perform that action at this time.
0 commit comments