feat: as docker mirror registry
feat: add global proxy config upgrade: upgrade front(angular) to 19 chore: deployment staff 1. Dockerfile: build frontend, backend, and run in nginx base image
This commit is contained in:
@ -2,13 +2,15 @@ package dbs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/glebarez/sqlite"
|
||||
"github.com/sirupsen/logrus"
|
||||
"gorm.io/gorm"
|
||||
"nf-repo/internal/interfaces"
|
||||
"nf-repo/internal/opt"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"nf-repo/internal/interfaces"
|
||||
"nf-repo/internal/opt"
|
||||
|
||||
"github.com/glebarez/sqlite"
|
||||
"github.com/loveuer/nf/nft/log"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type tx struct {
|
||||
@ -18,7 +20,7 @@ type tx struct {
|
||||
func (t *tx) TX(ctx context.Context) *gorm.DB {
|
||||
db := t.db.Session(&gorm.Session{}).WithContext(ctx)
|
||||
|
||||
if opt.Debug {
|
||||
if opt.Cfg.Debug {
|
||||
db = db.Debug()
|
||||
}
|
||||
|
||||
@ -31,24 +33,18 @@ func newTX(db *gorm.DB) interfaces.Database {
|
||||
|
||||
func Must(database interfaces.Database, err error) interfaces.Database {
|
||||
if err != nil {
|
||||
logrus.
|
||||
WithField("path", "tx.Must").
|
||||
WithField("err", err.Error()).
|
||||
Panic()
|
||||
log.Panic("tx.Must: err = %s", err.Error())
|
||||
}
|
||||
|
||||
if database == nil {
|
||||
logrus.
|
||||
WithField("path", "tx.Must").
|
||||
WithField("err", "database is nil").
|
||||
Panic()
|
||||
log.Panic("tx.Must: database is nil")
|
||||
}
|
||||
|
||||
return database
|
||||
}
|
||||
|
||||
func NewSqliteTX(filepath string) (interfaces.Database, error) {
|
||||
if err := os.MkdirAll(path.Dir(filepath), 0755); err != nil {
|
||||
if err := os.MkdirAll(path.Dir(filepath), 0o755); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user