Skip to content

Commit

Permalink
Added setup routine to the CLI.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfeidau committed Dec 13, 2015
1 parent 9eabe58 commit 4271f59
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
NAME=unicreds
ARCH=$(shell uname -m)
VERSION=1.0.0
GO15VENDOREXPERIMENT=1
GO15VENDOREXPERIMENT := 1

vendor:
godep save
godep save -t -v ./...

build:
rm -rf build && mkdir build
Expand Down
7 changes: 7 additions & 0 deletions cmd/unicreds/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ var (
alias = app.Flag("alias", "KMS key alias.").Default("alias/credstash").String()

// commands
cmdSetup = app.Command("setup", "Setup the dynamodb table used to store credentials.")

cmdGet = app.Command("get", "Get a credential from the store.")
cmdGetName = cmdGet.Arg("credential", "The name of the credential to get.").Required().String()

Expand All @@ -39,6 +41,11 @@ func main() {
app.Version(Version)

switch kingpin.MustParse(app.Parse(os.Args[1:])) {
case cmdSetup.FullCommand():
err := unicreds.Setup()
if err != nil {
printFatalError(err)
}
case cmdGet.FullCommand():
cred, err := unicreds.GetSecret(*cmdGetName)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions ds.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ type DecryptedCredential struct {
Secret string
}

// CreateDBTable create the table which stores credentials
func CreateDBTable() (err error) {
// Setup create the table which stores credentials
func Setup() (err error) {

res, err := dynamoSvc.CreateTable(&dynamodb.CreateTableInput{
AttributeDefinitions: []*dynamodb.AttributeDefinition{
Expand Down

0 comments on commit 4271f59

Please sign in to comment.