Commit WIP.
Laptop charger isn't charging?
This commit is contained in:
parent
8206458566
commit
eeec866a31
5 changed files with 35 additions and 3 deletions
17
internal/app/migration.go
Normal file
17
internal/app/migration.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"code.destrealm.net/zancarius/justusbot/internal/settings"
|
||||
"go.destrealm.net/migratory"
|
||||
)
|
||||
|
||||
func DoMigration(conf *settings.Settings) error {
|
||||
mg, err := migratory.New(conf.System.DSN)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_ = mg
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -9,6 +9,11 @@ import (
|
|||
|
||||
func connect(conf *settings.Settings) error {
|
||||
db, err := sql.Open("sqlite3", conf.System.DSN)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
_ = db
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import (
|
|||
|
||||
type Settings struct {
|
||||
file string `toml:"-"`
|
||||
fs vfs.VFS `toml:"-"`
|
||||
FS vfs.VFS `toml:"-"`
|
||||
API *API `toml:"api"`
|
||||
DailyScripture *DailyScripture `toml:"daily_scripture"`
|
||||
Translations *Translations `toml:"translations"`
|
||||
|
|
@ -26,7 +26,7 @@ type Settings struct {
|
|||
|
||||
// Reload previously loaded configuration.
|
||||
func (s *Settings) Reload() error {
|
||||
st, err := LoadSettings(s.file, s.fs)
|
||||
st, err := LoadSettings(s.file, s.FS)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ func (s *Settings) Save() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fp, err := s.fs.Mutable().OpenFile(s.file, os.O_TRUNC|os.O_CREATE, 0644)
|
||||
fp, err := s.FS.Mutable().OpenFile(s.file, os.O_TRUNC|os.O_CREATE, 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -70,6 +70,7 @@ type DailyScripture struct {
|
|||
|
||||
type System struct {
|
||||
TimeZone string `toml:"timezone"`
|
||||
DSN string `toml:"dsn"`
|
||||
}
|
||||
|
||||
type Service struct {
|
||||
|
|
|
|||
Loading…
Reference in a new issue