mirror of
https://github.com/go-shiori/shiori.git
synced 2024-11-16 22:25:13 +08:00
37 lines
732 B
Go
37 lines
732 B
Go
//go:generate go run assets-generator.go
|
|
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
fp "path/filepath"
|
|
|
|
"github.com/go-shiori/shiori/internal/cmd"
|
|
"github.com/go-shiori/shiori/internal/database"
|
|
_ "github.com/mattn/go-sqlite3"
|
|
"github.com/sirupsen/logrus"
|
|
|
|
// Add this to prevent it removed by go mod tidy
|
|
_ "github.com/shurcooL/vfsgen"
|
|
)
|
|
|
|
var dataDir = "dev-data"
|
|
|
|
func main() {
|
|
// Make sure data dir exists
|
|
os.MkdirAll(dataDir, os.ModePerm)
|
|
|
|
// Open database
|
|
dbPath := fp.Join(dataDir, "shiori.db")
|
|
sqliteDB, err := database.OpenSQLiteDatabase(dbPath)
|
|
if err != nil {
|
|
logrus.Fatalln(err)
|
|
}
|
|
|
|
// Execute cmd
|
|
cmd.DB = sqliteDB
|
|
cmd.DataDir = dataDir
|
|
if err := cmd.ShioriCmd().Execute(); err != nil {
|
|
logrus.Fatalln(err)
|
|
}
|
|
}
|