vault: the config has to be exported

This commit is contained in:
Mitchell Hashimoto
2015-03-12 10:22:12 -07:00
parent 59ce4265de
commit a0c8b7d7d1
3 changed files with 12 additions and 12 deletions

View File

@@ -97,30 +97,30 @@ type Core struct {
// CoreConfig is used to parameterize a core
type CoreConfig struct {
physical physical.Backend
logger *log.Logger
Physical physical.Backend
Logger *log.Logger
}
// NewCore isk used to construct a new core
func NewCore(conf *CoreConfig) (*Core, error) {
// Construct a new AES-GCM barrier
barrier, err := NewAESGCMBarrier(conf.physical)
barrier, err := NewAESGCMBarrier(conf.Physical)
if err != nil {
return nil, fmt.Errorf("barrier setup failed: %v", err)
}
// Make a default logger if not provided
if conf.logger == nil {
conf.logger = log.New(os.Stderr, "", log.LstdFlags)
if conf.Logger == nil {
conf.Logger = log.New(os.Stderr, "", log.LstdFlags)
}
// Setup the core
c := &Core{
physical: conf.physical,
physical: conf.Physical,
barrier: barrier,
router: NewRouter(),
sealed: true,
logger: conf.logger,
logger: conf.Logger,
}
return c, nil
}

View File

@@ -9,7 +9,7 @@ import (
func testCore(t *testing.T) *Core {
inm := physical.NewInmem()
conf := &CoreConfig{physical: inm}
conf := &CoreConfig{Physical: inm}
c, err := NewCore(conf)
if err != nil {
t.Fatalf("err: %v", err)
@@ -41,7 +41,7 @@ func testUnsealedCore(t *testing.T) (*Core, []byte) {
func TestCore_Init(t *testing.T) {
inm := physical.NewInmem()
conf := &CoreConfig{physical: inm}
conf := &CoreConfig{Physical: inm}
c, err := NewCore(conf)
if err != nil {
t.Fatalf("err: %v", err)

View File

@@ -10,7 +10,7 @@ func TestCore_DefaultMountTable(t *testing.T) {
verifyDefaultTable(t, c.mounts)
// Start a second core with same physical
conf := &CoreConfig{physical: c.physical}
conf := &CoreConfig{Physical: c.physical}
c2, err := NewCore(conf)
if err != nil {
t.Fatalf("err: %v", err)
@@ -45,7 +45,7 @@ func TestCore_MountEntry(t *testing.T) {
t.Fatalf("missing mount")
}
conf := &CoreConfig{physical: c.physical}
conf := &CoreConfig{Physical: c.physical}
c2, err := NewCore(conf)
if err != nil {
t.Fatalf("err: %v", err)
@@ -76,7 +76,7 @@ func TestCore_UnmountPath(t *testing.T) {
t.Fatalf("backend present")
}
conf := &CoreConfig{physical: c.physical}
conf := &CoreConfig{Physical: c.physical}
c2, err := NewCore(conf)
if err != nil {
t.Fatalf("err: %v", err)