mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
Link OSS (#18228)
* add Link config, init, and capabilities * add node status proto * bump protoc version to 3.21.9 * make proto * adding link tests * remove wrapped link * add changelog entry * update changelog entry
This commit is contained in:
@@ -1708,7 +1708,7 @@ func (c *ServerCommand) configureLogging(config *server.Config) (hclog.Intercept
|
||||
return loghelper.Setup(logCfg, c.logWriter)
|
||||
}
|
||||
|
||||
func (c *ServerCommand) reloadHCPLink(hcpLinkVault *hcp_link.WrappedHCPLinkVault, conf *server.Config, core *vault.Core, hcpLogger hclog.Logger) (*hcp_link.WrappedHCPLinkVault, error) {
|
||||
func (c *ServerCommand) reloadHCPLink(hcpLinkVault *hcp_link.HCPLinkVault, conf *server.Config, core *vault.Core, hcpLogger hclog.Logger) (*hcp_link.HCPLinkVault, error) {
|
||||
// trigger a shutdown
|
||||
if hcpLinkVault != nil {
|
||||
err := hcpLinkVault.Shutdown()
|
||||
|
||||
47
command/server/hcp_link_config_test.go
Normal file
47
command/server/hcp_link_config_test.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-test/deep"
|
||||
sdkResource "github.com/hashicorp/hcp-sdk-go/resource"
|
||||
"github.com/hashicorp/vault/internalshared/configutil"
|
||||
)
|
||||
|
||||
func TestHCPLinkConfig(t *testing.T) {
|
||||
config, err := LoadConfigFile("./test-fixtures/hcp_link_config.hcl")
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
resIDRaw := "organization/bc58b3d0-2eab-4ab8-abf4-f61d3c9975ff/project/1c78e888-2142-4000-8918-f933bbbc7690/hashicorp.example.resource/example"
|
||||
res, _ := sdkResource.FromString(resIDRaw)
|
||||
|
||||
expected := &Config{
|
||||
Storage: &Storage{
|
||||
Type: "inmem",
|
||||
Config: map[string]string{},
|
||||
},
|
||||
SharedConfig: &configutil.SharedConfig{
|
||||
Listeners: []*configutil.Listener{
|
||||
{
|
||||
Type: "tcp",
|
||||
Address: "127.0.0.1:8200",
|
||||
TLSDisable: true,
|
||||
CustomResponseHeaders: DefaultCustomHeaders,
|
||||
},
|
||||
},
|
||||
HCPLinkConf: &configutil.HCPLinkConfig{
|
||||
ResourceIDRaw: resIDRaw,
|
||||
Resource: &res,
|
||||
ClientID: "J2TtcSYOyPUkPV2z0mSyDtvitxLVjJmu",
|
||||
ClientSecret: "N9JtHZyOnHrIvJZs82pqa54vd4jnkyU3xCcqhFXuQKJZZuxqxxbP1xCfBZVB82vY",
|
||||
},
|
||||
DisableMlock: true,
|
||||
},
|
||||
}
|
||||
|
||||
config.Prune()
|
||||
if diff := deep.Equal(config, expected); diff != nil {
|
||||
t.Fatal(diff)
|
||||
}
|
||||
}
|
||||
11
command/server/test-fixtures/hcp_link_config.hcl
Normal file
11
command/server/test-fixtures/hcp_link_config.hcl
Normal file
@@ -0,0 +1,11 @@
|
||||
storage "inmem" {}
|
||||
listener "tcp" {
|
||||
address = "127.0.0.1:8200"
|
||||
tls_disable = true
|
||||
}
|
||||
cloud {
|
||||
resource_id = "organization/bc58b3d0-2eab-4ab8-abf4-f61d3c9975ff/project/1c78e888-2142-4000-8918-f933bbbc7690/hashicorp.example.resource/example"
|
||||
client_id = "J2TtcSYOyPUkPV2z0mSyDtvitxLVjJmu"
|
||||
client_secret = "N9JtHZyOnHrIvJZs82pqa54vd4jnkyU3xCcqhFXuQKJZZuxqxxbP1xCfBZVB82vY"
|
||||
}
|
||||
disable_mlock = true
|
||||
Reference in New Issue
Block a user