Use MySQL instead of SQLite
This commit is contained in:
parent
32e8f931b9
commit
8788eea4f0
4 changed files with 72 additions and 49 deletions
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math/rand"
|
||||
|
|
@ -42,7 +43,7 @@ func watchsubdir(watcher *inotify.Watcher, pathname string) error {
|
|||
}
|
||||
|
||||
func main() {
|
||||
var dbfile = flag.String("db", "fic.db", "Path to the DB")
|
||||
var dsn = flag.String("dsn", "fic:fic@/fic", "DSN to connect to the MySQL server")
|
||||
flag.StringVar(&BaseURL, "baseurl", "http://fic.srs.epita.fr/", "URL prepended to each URL")
|
||||
flag.StringVar(&SubmissionDir, "submission", "./submissions", "Base directory where save submissions")
|
||||
flag.StringVar(&TeamsDir, "teams", "../TEAMS", "Base directory where save teams JSON files")
|
||||
|
|
@ -60,7 +61,7 @@ func main() {
|
|||
}
|
||||
|
||||
log.Println("Opening DB...")
|
||||
if err := fic.DBInit(*dbfile); err != nil {
|
||||
if err := fic.DBInit(fmt.Sprintf("%s?parseTime=true", *dsn)); err != nil {
|
||||
log.Fatal("Cannot open the database: ", err)
|
||||
os.Exit(1)
|
||||
|
||||
|
|
|
|||
Reference in a new issue