Added opening in browser windows
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
069acabf1b
commit
99b486c73f
|
@ -11,4 +11,5 @@ Interface = :8080
|
|||
; Hier wird die Datenbank gespeichert
|
||||
DBFile = ./data.db
|
||||
; Ob Fenster geöffnet werden sollen, oder nicht.
|
||||
OpenWindows = true
|
||||
OpenWindows = true
|
||||
OpenBrowser = false
|
1
go.mod
1
go.mod
|
@ -13,6 +13,7 @@ require (
|
|||
github.com/labstack/echo/v4 v4.1.6
|
||||
github.com/labstack/gommon v0.3.0
|
||||
github.com/mattn/go-sqlite3 v1.11.0
|
||||
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
|
||||
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect
|
||||
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 // indirect
|
||||
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect
|
||||
|
|
2
go.sum
2
go.sum
|
@ -119,6 +119,8 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W
|
|||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98=
|
||||
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
|
|
4
main.go
4
main.go
|
@ -72,6 +72,10 @@ func main() {
|
|||
go windows.OpenWindows()
|
||||
}
|
||||
|
||||
if config.GetOpenBrowser() {
|
||||
go windows.OpenNativeWindows()
|
||||
}
|
||||
|
||||
// Wait for interrupt signal to gracefully shutdown the server with
|
||||
// a timeout of 10 seconds.
|
||||
quit := make(chan os.Signal, 1)
|
||||
|
|
|
@ -12,6 +12,7 @@ type Configuration struct {
|
|||
DBFile string
|
||||
Mode int
|
||||
OpenWindows bool
|
||||
OpenBrowser bool
|
||||
}
|
||||
|
||||
var siteConf = &Configuration{}
|
||||
|
@ -46,3 +47,7 @@ func GetDBFile() string {
|
|||
func GetOpenWindows() bool {
|
||||
return siteConf.OpenWindows
|
||||
}
|
||||
|
||||
func GetOpenBrowser() bool {
|
||||
return siteConf.OpenBrowser
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package windows
|
||||
|
||||
import (
|
||||
"git.kolaente.de/konrad/Konfi-Castle-Kasino/pkg/config"
|
||||
"github.com/labstack/gommon/log"
|
||||
"github.com/pkg/browser"
|
||||
)
|
||||
|
||||
func OpenNativeWindows() {
|
||||
err := browser.OpenURL("http://127.0.0.1" + config.GetInterface())
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
err = browser.OpenURL("http://127.0.0.1" + config.GetInterface() + "/admin")
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue