Move ConsulCAProviderConfig into structs package

This commit is contained in:
Kyle Havlovitz 2018-04-24 17:14:30 -07:00 committed by Mitchell Hashimoto
parent 887cc98d7e
commit 02fef5f9a2
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
3 changed files with 10 additions and 12 deletions

View File

@ -19,14 +19,8 @@ import (
"github.com/mitchellh/mapstructure"
)
type ConsulCAProviderConfig struct {
PrivateKey string
RootCert string
RotationPeriod time.Duration
}
type ConsulCAProvider struct {
config *ConsulCAProviderConfig
config *structs.ConsulCAProviderConfig
id string
srv *Server
@ -122,8 +116,8 @@ func NewConsulCAProvider(rawConfig map[string]interface{}, srv *Server) (*Consul
return provider, nil
}
func decodeConfig(raw map[string]interface{}) (*ConsulCAProviderConfig, error) {
var config *ConsulCAProviderConfig
func decodeConfig(raw map[string]interface{}) (*structs.ConsulCAProviderConfig, error) {
var config *structs.ConsulCAProviderConfig
if err := mapstructure.WeakDecode(raw, &config); err != nil {
return nil, fmt.Errorf("error decoding config: %s", err)
}

View File

@ -28,7 +28,5 @@ func TestCAProvider_Bootstrap(t *testing.T) {
state := s1.fsm.State()
_, activeRoot, err := state.CARootActive(nil)
assert.NoError(err)
assert.Equal(root.ID, activeRoot.ID)
assert.Equal(root.Name, activeRoot.Name)
assert.Equal(root.RootCert, activeRoot.RootCert)
assert.Equal(root, activeRoot.RootCert)
}

View File

@ -160,6 +160,12 @@ type CAConfiguration struct {
RaftIndex
}
type ConsulCAProviderConfig struct {
PrivateKey string
RootCert string
RotationPeriod time.Duration
}
// CAConsulProviderState is used to track the built-in Consul CA provider's state.
type CAConsulProviderState struct {
ID string