mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 11:48:04 +00:00
* Refactorings * save * REdesigning install dialog * Display values editor * Reconfigure flow * Status handler and version * error reporting
51 lines
1.0 KiB
Go
51 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/komodorio/helm-dashboard/pkg/dashboard"
|
|
log "github.com/sirupsen/logrus"
|
|
"github.com/toqueteos/webbrowser"
|
|
"os"
|
|
)
|
|
|
|
var (
|
|
version = "dev"
|
|
commit = "none"
|
|
date = "unknown"
|
|
)
|
|
|
|
func main() {
|
|
setupLogging()
|
|
|
|
// TODO: proper command-line parsing
|
|
if len(os.Args) > 1 { // dirty thing to allow --help to work
|
|
os.Exit(0)
|
|
}
|
|
|
|
address, webServerDone := dashboard.StartServer(version)
|
|
|
|
if os.Getenv("HD_NOBROWSER") == "" {
|
|
log.Infof("Opening web UI: %s", address)
|
|
err := webbrowser.Open(address)
|
|
if err != nil {
|
|
log.Warnf("Failed to open Web browser for URL: %s", err)
|
|
}
|
|
} else {
|
|
log.Infof("Access web UI at: %s", address)
|
|
}
|
|
|
|
<-webServerDone
|
|
log.Infof("Done.")
|
|
}
|
|
|
|
func setupLogging() {
|
|
if os.Getenv("DEBUG") == "" {
|
|
log.SetLevel(log.InfoLevel)
|
|
gin.SetMode(gin.ReleaseMode)
|
|
} else {
|
|
log.SetLevel(log.DebugLevel)
|
|
gin.SetMode(gin.DebugMode)
|
|
}
|
|
log.Infof("Helm Dashboard by Komodor, version %s (%s @ %s)", version, commit, date)
|
|
}
|