feat
- configuration
This commit is contained in:
1 parent
281d7d76d4
commit
a8f164c241
4 files changed
+60
-3
No files matched your search
+9
-1
@@ -7,10 +7,12 @@ import (
|
||||
"github.com/abelith/spellbook/internal/adapters/caster"
|
||||
"github.com/abelith/spellbook/internal/adapters/sqlite"
|
||||
"github.com/abelith/spellbook/internal/application"
|
||||
"github.com/abelith/spellbook/internal/config"
|
||||
"github.com/abelith/spellbook/internal/controllers/cli"
|
||||
_ "modernc.org/sqlite"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
@@ -25,7 +27,13 @@ func main() {
|
||||
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
||||
defer cancel()
|
||||
|
||||
db, err := sql.Open("sqlite", "db.sql")
|
||||
cfg, err := config.NewConfig()
|
||||
handleErr(err)
|
||||
|
||||
dir := filepath.Dir(cfg.DBPath)
|
||||
handleErr(os.MkdirAll(dir, 0755))
|
||||
|
||||
db, err := sql.Open("sqlite", cfg.DBPath)
|
||||
handleErr(err)
|
||||
|
||||
repo := sqlite.NewRepo(db)
|
||||
|
||||
Reference in new issue
Block a user