This repository has been archived by the owner on Mar 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed to REST proxy and project split into cmd and pkg
- Loading branch information
Showing
5 changed files
with
108 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# secrethub-clientd | ||
# secrethub-proxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/keylockerbv/secrethub-clientd/pkg/restproxy" | ||
"github.com/keylockerbv/secrethub-go/pkg/secrethub" | ||
) | ||
|
||
var ( | ||
credential string | ||
credentialPassphrase string | ||
port int | ||
client secrethub.Client | ||
) | ||
|
||
func init() { | ||
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") | ||
flag.Parse() | ||
|
||
if credential == "" { | ||
flag.Usage() | ||
exit(fmt.Errorf("credential is required")) | ||
} | ||
|
||
cred, err := secrethub.NewCredential(credential, credentialPassphrase) | ||
if err != nil { | ||
exit(err) | ||
} | ||
|
||
client = secrethub.NewClient(cred, nil) | ||
} | ||
|
||
func main() { | ||
clientd := restproxy.SecretHubRESTProxy{ | ||
Client: &client, | ||
Port: port, | ||
} | ||
fmt.Println("SecretHub REST proxy started, press ^C to stop it") | ||
err := clientd.Start() | ||
if err != nil { | ||
exit(err) | ||
} | ||
} | ||
|
||
func exit(err error) { | ||
fmt.Printf("secrethub-clientd: error: %v\n", err) | ||
os.Exit(1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
module github.com/keylockerbv/secrethub-clientd | ||
|
||
require ( | ||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect | ||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect | ||
github.com/atotto/clipboard v0.1.1 // indirect | ||
github.com/gorilla/mux v1.7.0 | ||
github.com/jmoiron/sqlx v1.2.0 // indirect | ||
github.com/keylockerbv/secrethub v0.17.0 | ||
github.com/keylockerbv/secrethub-go v0.0.0-20190225132925-244d98858e9d | ||
github.com/mattn/go-sqlite3 v1.10.0 // indirect | ||
github.com/stretchr/testify v1.3.0 // indirect | ||
golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b // indirect | ||
google.golang.org/appengine v1.4.0 // indirect | ||
gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters