Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ func Export(path, file, metad, ver string) error {
pairs = append(pairs, Pair{Key: k, Value: str})
}
}
items = append(items, Item{Path: p, Pairs: pairs})

relativePath := strings.TrimPrefix(p, path)
items = append(items, Item{Path: relativePath, Pairs: pairs})
}

// Convert to json and write to a file
Expand Down
16 changes: 14 additions & 2 deletions cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"strings"

"github.com/adamdecaf/vault-backend-migrator/vault"
)
Expand All @@ -17,6 +18,16 @@ func Import(path, file, ver string) error {
return err
}

// Make sure path has a leading slash
if !strings.HasPrefix(path, "/") {
path = "/" + path
}

// Make sure path has a trailing slash
if !strings.HasSuffix(path, "/") {
path = path + "/"
}

// Check the input file exists
if _, err := os.Stat(abs); err != nil {
f, err := os.Create(abs)
Expand Down Expand Up @@ -54,8 +65,9 @@ func Import(path, file, ver string) error {
for _, kv := range item.Pairs {
data[kv.Key] = kv.Value
}
fmt.Printf("Writing %s\n", item.Path)
if err := v.Write(item.Path, data, ver); err != nil {
fullPath := path + item.Path
fmt.Printf("Writing %s\n", fullPath)
if err := v.Write(fullPath, data, ver); err != nil {
fmt.Printf("Error %s\n", err)
}
}
Expand Down
133 changes: 0 additions & 133 deletions vendor/golang.org/x/text/unicode/bidi/gen.go

This file was deleted.

57 changes: 0 additions & 57 deletions vendor/golang.org/x/text/unicode/bidi/gen_ranges.go

This file was deleted.

64 changes: 0 additions & 64 deletions vendor/golang.org/x/text/unicode/bidi/gen_trieval.go

This file was deleted.

Loading