diff --git a/Makefile b/Makefile index 85bf405..1f9408c 100644 --- a/Makefile +++ b/Makefile @@ -33,8 +33,18 @@ binaries: rm -f awwkoala mkdir binaries env GOOS=linux GOARCH=amd64 go build -o awwkoala -v *.go - zip -9 -r awwkoala-linux-amd64.zip awwkoala static/* templates/* + zip -9 -r awwkoala-linux-64bit.zip awwkoala static/* templates/* rm -f awwkoala + env GOOS=windows GOARCH=amd64 go build -o awwkoala.exe -v *.go + zip -9 -r awwkoala-windows-64bit.zip awwkoala.exe static/* templates/* + rm -f awwkoala.exe + env GOOS=linux GOARCH=arm go build -o awwkoala -v *.go + zip -9 -r awwkoala-raspberrypi.zip awwkoala static/* templates/* + rm -f awwkoala + env GOOS=darwin GOARCH=amd64 go build -o awwkoala -v *.go + zip -9 -r awwkoala-macosx-64bit.zip awwkoala static/* templates/* + rm -f awwkoala + mv *.zip binaries/ .PHONY: install diff --git a/main.go b/main.go index 2da460e..9fb6fad 100644 --- a/main.go +++ b/main.go @@ -4,10 +4,8 @@ import ( "flag" "fmt" "io/ioutil" - "log" "os" "path" - "runtime" "github.com/boltdb/bolt" "github.com/gin-gonic/gin" @@ -37,8 +35,8 @@ var RuntimeArgs struct { var VersionNum string func main() { - VersionNum = "1.1" - _, executableFile, _, _ := runtime.Caller(0) // get full path of this file + VersionNum = "1.2" + // _, executableFile, _, _ := runtime.Caller(0) // get full path of this file cwd, _ := os.Getwd() databaseFile := path.Join(cwd, "data.db") flag.StringVar(&RuntimeArgs.Port, "p", ":8003", "port to bind") @@ -63,7 +61,7 @@ Options:`) if RuntimeArgs.ExternalIP == "" { RuntimeArgs.ExternalIP = GetLocalIP() + RuntimeArgs.Port } - RuntimeArgs.SourcePath = path.Dir(executableFile) + RuntimeArgs.SourcePath = cwd Open(RuntimeArgs.DatabaseLocation) defer Close() @@ -87,7 +85,6 @@ Options:`) // var q WikiData // q.load("about") // fmt.Println(getImportantVersions(q)) - log.Println(RuntimeArgs.AdminKey) r := gin.Default() r.LoadHTMLGlob(path.Join(RuntimeArgs.SourcePath, "templates/*")) @@ -100,13 +97,15 @@ Options:`) if RuntimeArgs.ServerCRT != "" && RuntimeArgs.ServerKey != "" { RuntimeArgs.Socket = "wss" fmt.Println("--------------------------") - fmt.Println("AwwKoala is up and running on https://" + RuntimeArgs.ExternalIP) + fmt.Println("AwwKoala (version " + VersionNum + ") is up and running on https://" + RuntimeArgs.ExternalIP) + fmt.Println("Admin key: " + RuntimeArgs.AdminKey) fmt.Println("--------------------------") r.RunTLS(RuntimeArgs.Port, RuntimeArgs.ServerCRT, RuntimeArgs.ServerKey) } else { RuntimeArgs.Socket = "ws" fmt.Println("--------------------------") - fmt.Println("AwwKoala is up and running on http://" + RuntimeArgs.ExternalIP) + fmt.Println("AwwKoala (version " + VersionNum + ") is up and running on http://" + RuntimeArgs.ExternalIP) + fmt.Println("Admin key: " + RuntimeArgs.AdminKey) fmt.Println("--------------------------") r.Run(RuntimeArgs.Port) }