justusbot/internal/commands/install.go

38 lines
826 B
Go
Raw Normal View History

2026-10-08 15:38:12 -06:00
package commands
import (
"context"
"fmt"
"code.destrealm.net/zancarius/justusbot/internal/models"
"code.destrealm.net/zancarius/justusbot/internal/settings"
"github.com/urfave/cli/v3"
"go.destrealm.net/errors"
"go.destrealm.net/logging/v3"
"go.destrealm.net/vfs"
)
type installer struct {
fs vfs.VFS
logger *logging.Log
settings *settings.Settings
}
func initInstaller(fs vfs.VFS, settings *settings.Settings) (*installer, error) {
return &installer{
fs,
logging.Get("initializer"),
settings,
}, nil
}
func (inst *installer) DoInstall(ctx context.Context, cmd *cli.Command) error {
fmt.Println(inst.settings)
db := models.OpenDatabase(inst.settings)
2026-10-08 15:38:12 -06:00
fmt.Println(inst.settings.System.DSN)
err := db.Migrate(inst.fs)
if err != nil {
inst.logger.Error(errors.Unfurl(err))
}
return nil
}