Create common errorID generation (#788)

This commit is contained in:
Louis Ruch authored and GitHub committed 2020-11-16 13:51:11 -08:00
1 parent d8020842ae
commit b8a5b9adf1
2 files changed
+23

No files matched your search

+4
View File
@@ -27,6 +27,10 @@ dev: build-ui-ifne
@echo "==> Building Boundary with dev and UI features enabled"
@CGO_ENABLED=$(CGO_ENABLED) BUILD_TAGS='$(BUILD_TAGS)' BOUNDARY_DEV_BUILD=1 sh -c "'$(CURDIR)/scripts/build.sh'"
rand:
@echo "==> Generating random boundary error ID"
@go run scripts/errorid.go
bin: BUILD_TAGS+=ui
bin: build-ui
@echo "==> Building Boundary with UI features enabled"
+19
View File
@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"github.com/hashicorp/vault/sdk/helper/base62"
)
const idLength = 10
func main() {
rand, err := base62.Random(idLength)
if err != nil {
fmt.Printf("failed to generate error ID: %v\n", err)
os.Exit(1)
}
fmt.Println(rand)
}