Migrate ParseAddress to shared-secure-libs (#1313)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-06-15 13:35:29 -04:00
1 parent 8c63ede9cc
commit 9c945b7021
6 files changed
+24 -56

No files matched your search

+5 -4
View File
@@ -9,6 +9,7 @@ import (
"github.com/hashicorp/boundary/internal/types/scope"
"github.com/hashicorp/boundary/sdk/wrapper"
wrapping "github.com/hashicorp/go-kms-wrapping"
"github.com/hashicorp/shared-secure-libs/configutil"
"github.com/hashicorp/vault/sdk/helper/mlock"
"github.com/mitchellh/cli"
"github.com/posener/complete"
@@ -233,8 +234,8 @@ func (c *InitCommand) Run(args []string) (retCode int) {
return base.CommandUserError
}
migrationUrl, err := config.ParseAddress(migrationUrlToParse)
if err != nil && err != config.ErrNotAUrl {
migrationUrl, err := configutil.ParsePath(migrationUrlToParse)
if err != nil && !errors.Is(err, configutil.ErrNotAUrl) {
c.UI.Error(fmt.Errorf("Error parsing migration url: %w", err).Error())
return base.CommandUserError
}
@@ -254,8 +255,8 @@ func (c *InitCommand) Run(args []string) (retCode int) {
c.UI.Error(`"url" not specified in "database" config block`)
return base.CommandUserError
}
c.srv.DatabaseUrl, err = config.ParseAddress(urlToParse)
if err != nil && err != config.ErrNotAUrl {
c.srv.DatabaseUrl, err = configutil.ParsePath(urlToParse)
if err != nil && !errors.Is(err, configutil.ErrNotAUrl) {
c.UI.Error(fmt.Errorf("Error parsing database url: %w", err).Error())
return base.CommandUserError
}
+4 -2
View File
@@ -5,8 +5,10 @@ import (
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/hashicorp/boundary/internal/cmd/config"
"github.com/hashicorp/boundary/internal/errors"
"github.com/hashicorp/boundary/sdk/wrapper"
wrapping "github.com/hashicorp/go-kms-wrapping"
"github.com/hashicorp/shared-secure-libs/configutil"
"github.com/hashicorp/vault/sdk/helper/mlock"
"github.com/mitchellh/cli"
"github.com/posener/complete"
@@ -174,8 +176,8 @@ func (c *MigrateCommand) Run(args []string) (retCode int) {
return base.CommandUserError
}
migrationUrl, err := config.ParseAddress(migrationUrlToParse)
if err != nil && err != config.ErrNotAUrl {
migrationUrl, err := configutil.ParsePath(migrationUrlToParse)
if err != nil && !errors.Is(err, configutil.ErrNotAUrl) {
c.UI.Error(fmt.Errorf("Error parsing migration url: %w", err).Error())
return base.CommandUserError
}