Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 120cabd

Browse files
committed
Remove unauthenticated client
This is no longer necessary now that the signup command is removed.
1 parent b24de2d commit 120cabd

3 files changed

Lines changed: 2 additions & 16 deletions

File tree

internals/secrethub/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (app *App) registerCommands() {
175175
NewEnvCommand(app.io, app.clientFactory.NewClient).Register(app.cli)
176176

177177
// Commands
178-
NewInitCommand(app.io, app.clientFactory.NewUnauthenticatedClient, app.clientFactory.NewClientWithCredentials, app.credentialStore).Register(app.cli)
178+
NewInitCommand(app.io, app.clientFactory.NewClientWithCredentials, app.credentialStore).Register(app.cli)
179179
NewSignUpCommand(app.io).Register(app.cli)
180180
NewWriteCommand(app.io, app.clientFactory.NewClient).Register(app.cli)
181181
NewReadCommand(app.io, app.clientFactory.NewClient).Register(app.cli)

internals/secrethub/client_factory.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ type ClientFactory interface {
2020
// NewClient returns a new SecretHub client.
2121
NewClient() (secrethub.ClientInterface, error)
2222
NewClientWithCredentials(credentials.Provider) (secrethub.ClientInterface, error)
23-
NewUnauthenticatedClient() (secrethub.ClientInterface, error)
2423
Register(FlagRegisterer)
2524
}
2625

@@ -89,17 +88,6 @@ func (f *clientFactory) NewClientWithCredentials(provider credentials.Provider)
8988
return client, nil
9089
}
9190

92-
func (f *clientFactory) NewUnauthenticatedClient() (secrethub.ClientInterface, error) {
93-
options := f.baseClientOptions()
94-
95-
client, err := secrethub.NewClient(options...)
96-
if err != nil {
97-
return nil, err
98-
}
99-
100-
return client, nil
101-
}
102-
10391
func (f *clientFactory) baseClientOptions() []secrethub.ClientOption {
10492
options := []secrethub.ClientOption{
10593
secrethub.WithConfigDir(f.store.ConfigDir()),

internals/secrethub/init.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,15 @@ type InitCommand struct {
2525
setupCode string
2626
force bool
2727
io ui.IO
28-
newUnauthenticatedClient newClientFunc
2928
newClientWithCredentials func(credentials.Provider) (secrethub.ClientInterface, error)
3029
credentialStore CredentialConfig
3130
progressPrinter progress.Printer
3231
}
3332

3433
// NewInitCommand creates a new InitCommand.
35-
func NewInitCommand(io ui.IO, newUnauthenticatedClient newClientFunc, newClientWithCredentials func(credentials.Provider) (secrethub.ClientInterface, error), credentialStore CredentialConfig) *InitCommand {
34+
func NewInitCommand(io ui.IO, newClientWithCredentials func(credentials.Provider) (secrethub.ClientInterface, error), credentialStore CredentialConfig) *InitCommand {
3635
return &InitCommand{
3736
io: io,
38-
newUnauthenticatedClient: newUnauthenticatedClient,
3937
newClientWithCredentials: newClientWithCredentials,
4038
credentialStore: credentialStore,
4139
progressPrinter: progress.NewPrinter(io.Output(), 500*time.Millisecond),

0 commit comments

Comments
 (0)