Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command to support listing secrets #8

Merged
merged 6 commits into from
Nov 9, 2023
Merged

Command to support listing secrets #8

merged 6 commits into from
Nov 9, 2023

Conversation

shubhamvernekar
Copy link
Contributor

@shubhamvernekar shubhamvernekar commented Nov 4, 2023

dolores -env production config list

listing all the secrets in cloud and show in tabuler commandline output.

Screenshot 2023-11-06 at 7 41 11 PM

client/monart.go Outdated Show resolved Hide resolved
client/client.go Outdated Show resolved Hide resolved
client/monart.go Outdated Show resolved Hide resolved
secrets/manager.go Outdated Show resolved Hide resolved
secrets/manager.go Outdated Show resolved Hide resolved
secrets/manager.go Show resolved Hide resolved
client/client.go Outdated
type GetSecretListConfig struct {
Environment string `json:"environment"`
}
type GetSecretListResponse struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could ignore Get prefix https://go.dev/doc/effective_go#Getters

@@ -23,7 +24,7 @@ type Service struct {
type gcsStore interface {
WriteToObject(ctx context.Context, bucketName, fileName string, data []byte) error
ReadObject(ctx context.Context, bucketName, fileName string) ([]byte, error)
ListOjbect(ctx context.Context, bucketName, path string) ([]string, error)
ListObject(ctx context.Context, bucketName, path string) ([]google.SecretObject, error)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be google.Object from google's package perspective (GCS object), it doesn't know anything about secrets. In callers, it could be used for secrets or users or any abstraction.

@@ -77,13 +78,13 @@ func (s Service) GetOrgPublicKeys(ctx context.Context, env, bucketName, path str
if pubKey != "" {
return []string{pubKey}, nil
}
resp, err := s.store.ListOjbect(ctx, bucketName, path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's meant for abstraction/local, keep it private.
Also i don't see any logic handled under GetObjList except just returning error and repeated here as well, why do we need this method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GetObjList is added beause i dont wnat client to directly call store.ListObject

client/monart.go Outdated
if err != nil {
return nil, fmt.Errorf("unable to build Get SecretList request: %w", err)
}
result := new(GetSecretListResponse)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a response type here and we should be building location here, google/gcs.go should only set the fields as is.

@devdinu
Copy link
Member

devdinu commented Nov 9, 2023

  • The time formatting seems to be off 31000-10-31 15:46:45.542
  • We could add tab/predefined space between the columns

@devdinu devdinu merged commit f36e031 into main Nov 9, 2023
1 of 3 checks passed
@devdinu devdinu deleted the listing-secrets branch November 9, 2023 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants