3
0
Files
corteza/app/boot_dal.go
Denis Arh bdd9318f93 Refactor and improve DAL implementation and init
Changes:
 - Boot initialization follows standard impl
 - Improved DAL connection management (adding, reloading, removing)
 - Cleaner and more detailed logging
 - Primary store connection is now reused when added to DAL
2022-07-01 18:13:54 +02:00

27 lines
523 B
Go

package app
import (
"context"
"fmt"
"github.com/cortezaproject/corteza-server/pkg/dal"
"go.uber.org/zap"
)
func (app *CortezaApp) initDAL(ctx context.Context, log *zap.Logger) (err error) {
// Verify that primary store is connected
// or return error
if app.Store == nil {
return fmt.Errorf("primary store not connected")
}
// Init DAL and prepare default connection
svc, err := dal.New(log.Named("dal"), app.Opt.Environment.IsDevelopment())
if err != nil {
return err
}
dal.SetGlobal(svc)
return
}