Move ConsulCAProviderConfig into structs package
This commit is contained in:
parent
887cc98d7e
commit
02fef5f9a2
|
@ -19,14 +19,8 @@ import (
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ConsulCAProviderConfig struct {
|
|
||||||
PrivateKey string
|
|
||||||
RootCert string
|
|
||||||
RotationPeriod time.Duration
|
|
||||||
}
|
|
||||||
|
|
||||||
type ConsulCAProvider struct {
|
type ConsulCAProvider struct {
|
||||||
config *ConsulCAProviderConfig
|
config *structs.ConsulCAProviderConfig
|
||||||
|
|
||||||
id string
|
id string
|
||||||
srv *Server
|
srv *Server
|
||||||
|
@ -122,8 +116,8 @@ func NewConsulCAProvider(rawConfig map[string]interface{}, srv *Server) (*Consul
|
||||||
return provider, nil
|
return provider, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodeConfig(raw map[string]interface{}) (*ConsulCAProviderConfig, error) {
|
func decodeConfig(raw map[string]interface{}) (*structs.ConsulCAProviderConfig, error) {
|
||||||
var config *ConsulCAProviderConfig
|
var config *structs.ConsulCAProviderConfig
|
||||||
if err := mapstructure.WeakDecode(raw, &config); err != nil {
|
if err := mapstructure.WeakDecode(raw, &config); err != nil {
|
||||||
return nil, fmt.Errorf("error decoding config: %s", err)
|
return nil, fmt.Errorf("error decoding config: %s", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,5 @@ func TestCAProvider_Bootstrap(t *testing.T) {
|
||||||
state := s1.fsm.State()
|
state := s1.fsm.State()
|
||||||
_, activeRoot, err := state.CARootActive(nil)
|
_, activeRoot, err := state.CARootActive(nil)
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
assert.Equal(root.ID, activeRoot.ID)
|
assert.Equal(root, activeRoot.RootCert)
|
||||||
assert.Equal(root.Name, activeRoot.Name)
|
|
||||||
assert.Equal(root.RootCert, activeRoot.RootCert)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,6 +160,12 @@ type CAConfiguration struct {
|
||||||
RaftIndex
|
RaftIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ConsulCAProviderConfig struct {
|
||||||
|
PrivateKey string
|
||||||
|
RootCert string
|
||||||
|
RotationPeriod time.Duration
|
||||||
|
}
|
||||||
|
|
||||||
// CAConsulProviderState is used to track the built-in Consul CA provider's state.
|
// CAConsulProviderState is used to track the built-in Consul CA provider's state.
|
||||||
type CAConsulProviderState struct {
|
type CAConsulProviderState struct {
|
||||||
ID string
|
ID string
|
||||||
|
|
Loading…
Reference in New Issue