1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Bumped version

This commit is contained in:
Zack Scholl 2016-02-15 17:22:06 -05:00
parent 3c53546c48
commit 477838db7b
2 changed files with 18 additions and 9 deletions

View File

@ -33,8 +33,18 @@ binaries:
rm -f awwkoala rm -f awwkoala
mkdir binaries mkdir binaries
env GOOS=linux GOARCH=amd64 go build -o awwkoala -v *.go 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 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 .PHONY: install

15
main.go
View File

@ -4,10 +4,8 @@ import (
"flag" "flag"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"log"
"os" "os"
"path" "path"
"runtime"
"github.com/boltdb/bolt" "github.com/boltdb/bolt"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@ -37,8 +35,8 @@ var RuntimeArgs struct {
var VersionNum string var VersionNum string
func main() { func main() {
VersionNum = "1.1" VersionNum = "1.2"
_, executableFile, _, _ := runtime.Caller(0) // get full path of this file // _, executableFile, _, _ := runtime.Caller(0) // get full path of this file
cwd, _ := os.Getwd() cwd, _ := os.Getwd()
databaseFile := path.Join(cwd, "data.db") databaseFile := path.Join(cwd, "data.db")
flag.StringVar(&RuntimeArgs.Port, "p", ":8003", "port to bind") flag.StringVar(&RuntimeArgs.Port, "p", ":8003", "port to bind")
@ -63,7 +61,7 @@ Options:`)
if RuntimeArgs.ExternalIP == "" { if RuntimeArgs.ExternalIP == "" {
RuntimeArgs.ExternalIP = GetLocalIP() + RuntimeArgs.Port RuntimeArgs.ExternalIP = GetLocalIP() + RuntimeArgs.Port
} }
RuntimeArgs.SourcePath = path.Dir(executableFile) RuntimeArgs.SourcePath = cwd
Open(RuntimeArgs.DatabaseLocation) Open(RuntimeArgs.DatabaseLocation)
defer Close() defer Close()
@ -87,7 +85,6 @@ Options:`)
// var q WikiData // var q WikiData
// q.load("about") // q.load("about")
// fmt.Println(getImportantVersions(q)) // fmt.Println(getImportantVersions(q))
log.Println(RuntimeArgs.AdminKey)
r := gin.Default() r := gin.Default()
r.LoadHTMLGlob(path.Join(RuntimeArgs.SourcePath, "templates/*")) r.LoadHTMLGlob(path.Join(RuntimeArgs.SourcePath, "templates/*"))
@ -100,13 +97,15 @@ Options:`)
if RuntimeArgs.ServerCRT != "" && RuntimeArgs.ServerKey != "" { if RuntimeArgs.ServerCRT != "" && RuntimeArgs.ServerKey != "" {
RuntimeArgs.Socket = "wss" RuntimeArgs.Socket = "wss"
fmt.Println("--------------------------") 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("--------------------------") fmt.Println("--------------------------")
r.RunTLS(RuntimeArgs.Port, RuntimeArgs.ServerCRT, RuntimeArgs.ServerKey) r.RunTLS(RuntimeArgs.Port, RuntimeArgs.ServerCRT, RuntimeArgs.ServerKey)
} else { } else {
RuntimeArgs.Socket = "ws" RuntimeArgs.Socket = "ws"
fmt.Println("--------------------------") 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("--------------------------") fmt.Println("--------------------------")
r.Run(RuntimeArgs.Port) r.Run(RuntimeArgs.Port)
} }