Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Initial HTTP server implementation #1

Merged
merged 9 commits into from
Mar 4, 2019
Merged

Initial HTTP server implementation #1

merged 9 commits into from
Mar 4, 2019

Conversation

florisvdg
Copy link
Member

@florisvdg florisvdg commented Feb 25, 2019

Very basic implementation to be able to act as a Terraform state backend

@florisvdg florisvdg changed the base branch from master to develop February 25, 2019 14:01
Copy link
Member

@mackenbach mackenbach left a comment

Choose a reason for hiding this comment

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

Did a quick review. Have a look.

flag.StringVar(&address, "a", ":8080", "HTTP server address")
flag.Parse()

if credential == "" {
Copy link
Member

Choose a reason for hiding this comment

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

I would like to see these flags either sourced from:

  1. The default ~/.secrethub/credential file
  2. The SECRETHUB_CREDENTIAL envar
  3. The --credential flag

It's not entirely necessary for the MVP, but it would be very nice to make it consistent with current CLI behavior.

Copy link
Member Author

Choose a reason for hiding this comment

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

Would be nice if the same DRY function could be used there. What do you think @SimonBarendse?

Copy link
Member

Choose a reason for hiding this comment

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

I agree that would be the preferred end-state.

However, I think for now it’s better to duplicate it in an internal package, so that the cli open-source release doesnt become a blocker for the terrraform open-source release. If we use the same signature, we can replace it (deduplicate) with the cli package when that is open-source.

main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
Copy link
Member

@mackenbach mackenbach left a comment

Choose a reason for hiding this comment

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

Few comments, nice changes!

main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Show resolved Hide resolved
main.go Show resolved Hide resolved
@@ -56,7 +56,7 @@ func startHTTPServer() error {
)

fmt.Println("SecretHub Clientd started, press ^C to exit")
return http.ListenAndServe(address, mux)
return http.ListenAndServe(fmt.Sprintf(":%v", port), mux)
Copy link
Member

Choose a reason for hiding this comment

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

I think %v works here, but to be 'correct' it should be %d. If it works, fine.

flag.StringVar(&address, "a", ":8080", "HTTP server address")
flag.StringVar(&credential, "C", "", "(Required) SecretHub credential")
flag.StringVar(&credentialPassphrase, "P", "", "Passphrase to unlock SecretHub credential")
flag.IntVar(&port, "p", 8080, "HTTP port to listen on")
Copy link
Member

Choose a reason for hiding this comment

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

The SecretHub CLI has a --credential-passphrase flag with a shortcut -p. Not sure what we want to do here

@florisvdg florisvdg merged commit 1414f3e into develop Mar 4, 2019
@florisvdg florisvdg deleted the http-server branch March 4, 2019 16:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants