1598ec47ff
Signed-off-by: Sven Dowideit <sven.dowideit@portainer.io>
20 lines
497 B
Go
20 lines
497 B
Go
package database
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/portainer/portainer/api/database/boltdb"
|
|
)
|
|
|
|
// NewDatabase should use config options to return a connection to the requested database
|
|
func NewDatabase(storeType, storePath string, encryptionKey []byte) (connection Connection, err error) {
|
|
switch storeType {
|
|
case "boltdb":
|
|
return &boltdb.DbConnection{
|
|
Path: storePath,
|
|
EncryptionKey: encryptionKey,
|
|
}, nil
|
|
}
|
|
return nil, fmt.Errorf("unknown storage database: %s", storeType)
|
|
}
|