qa-svelte: initial commit
This commit is contained in:
parent
abdf146fea
commit
0fe037d7f5
43 changed files with 2089 additions and 1297 deletions
21
qa/main.go
21
qa/main.go
|
|
@ -2,14 +2,12 @@ package main
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"io/fs"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
|
|
@ -17,8 +15,6 @@ import (
|
|||
"srs.epita.fr/fic-server/qa/api"
|
||||
)
|
||||
|
||||
var StaticDir string
|
||||
|
||||
type ResponseWriterPrefix struct {
|
||||
real http.ResponseWriter
|
||||
prefix string
|
||||
|
|
@ -69,7 +65,7 @@ func main() {
|
|||
var bind = flag.String("bind", "127.0.0.1:8083", "Bind port/socket")
|
||||
var dsn = flag.String("dsn", fic.DSNGenerator(), "DSN to connect to the MySQL server")
|
||||
flag.StringVar(&BaseURL, "baseurl", BaseURL, "URL prepended to each URL")
|
||||
flag.StringVar(&StaticDir, "static", "./htdocs-qa/", "Directory containing static files")
|
||||
flag.StringVar(&DevProxy, "dev", DevProxy, "Proxify traffic to this host for static assets")
|
||||
flag.StringVar(&api.TeamsDir, "teams", "./TEAMS", "Base directory where save teams JSON files")
|
||||
flag.StringVar(&api.Simulator, "simulator", "", "Auth string to simulate (for development only)")
|
||||
flag.Parse()
|
||||
|
|
@ -79,21 +75,6 @@ func main() {
|
|||
// Sanitize options
|
||||
var err error
|
||||
log.Println("Checking paths...")
|
||||
if StaticDir != "" {
|
||||
if sDir, err := filepath.Abs(StaticDir); err != nil {
|
||||
log.Fatal(err)
|
||||
} else {
|
||||
log.Println("Serving pages from", sDir)
|
||||
staticFS = http.Dir(sDir)
|
||||
}
|
||||
} else {
|
||||
sub, err := fs.Sub(assets, "static")
|
||||
if err != nil {
|
||||
log.Fatal("Unable to cd to static/ directory:", err)
|
||||
}
|
||||
log.Println("Serving pages from memory.")
|
||||
staticFS = http.FS(sub)
|
||||
}
|
||||
if BaseURL != "/" {
|
||||
BaseURL = path.Clean(BaseURL)
|
||||
} else {
|
||||
|
|
|
|||
Reference in a new issue