Compare commits
2 Commits
1a78164472
...
b7d218eda3
Author | SHA1 | Date | |
---|---|---|---|
b7d218eda3 | |||
587c4a7f43 |
2
Makefile
2
Makefile
@ -42,7 +42,7 @@ live/sync_assets:
|
||||
--build.include_dir "assets" \
|
||||
--build.include_ext "js,css"
|
||||
|
||||
# start all 6 watch processes in parallel.
|
||||
# start all 5 watch processes in parallel.
|
||||
live:
|
||||
ENVIRONMENT="DEVELOPMENT" make -j5 live/tailwind live/templ live/server live/esbuild live/sync_assets
|
||||
|
||||
|
@ -9,7 +9,7 @@ This project provides a comprehensive internet speed monitoring solution by:
|
||||
|
||||
## Usage
|
||||
|
||||
1. Go to the [releases tab](/releases/latest)
|
||||
1. Go to the [releases tab](releases/latest)
|
||||
1. download the latest version
|
||||
1. execute the binary
|
||||
1. wait for data (like 5min)
|
||||
|
@ -6,16 +6,18 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"gitea.zokki.net/zokki/speed-tester/models"
|
||||
_ "github.com/mattn/go-sqlite3" // Import the SQLite driver
|
||||
"github.com/showwin/speedtest-go/speedtest"
|
||||
|
||||
"gitea.zokki.net/zokki/speed-tester/flag"
|
||||
"gitea.zokki.net/zokki/speed-tester/models"
|
||||
)
|
||||
|
||||
var DB *sql.DB
|
||||
|
||||
func init() {
|
||||
var err error
|
||||
DB, err = sql.Open("sqlite3", "./speed-data.db")
|
||||
DB, err = sql.Open("sqlite3", *flag.DbPath)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
8
flag/flag.go
Normal file
8
flag/flag.go
Normal file
@ -0,0 +1,8 @@
|
||||
package flag
|
||||
|
||||
import "flag"
|
||||
|
||||
var (
|
||||
Port = flag.Int("port", 9512, "port to serve the web-application")
|
||||
DbPath = flag.String("db-path", "./speed-data.db", "the path to the SQLite database")
|
||||
)
|
10
main.go
10
main.go
@ -2,16 +2,18 @@ package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitea.zokki.net/zokki/speed-tester/database"
|
||||
"gitea.zokki.net/zokki/speed-tester/routes"
|
||||
_ "github.com/mattn/go-sqlite3" // Import the SQLite driver
|
||||
"github.com/showwin/speedtest-go/speedtest"
|
||||
|
||||
"gitea.zokki.net/zokki/speed-tester/database"
|
||||
"gitea.zokki.net/zokki/speed-tester/flag"
|
||||
"gitea.zokki.net/zokki/speed-tester/routes"
|
||||
)
|
||||
|
||||
var isDev = strings.ToUpper(os.Getenv("ENVIRONMENT")) == "DEVELOPMENT"
|
||||
@ -46,7 +48,7 @@ func main() {
|
||||
}
|
||||
|
||||
server := http.Server{
|
||||
Addr: ":9512",
|
||||
Addr: fmt.Sprintf(":%d", *flag.Port),
|
||||
Handler: router,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user