Initial features pt 2 (#3)

* Less logging when not in DEBUG

* Check helm is fine

* Display kube context switch

* Cosmetics

* Displays list of chartss

* Linter stuff

* Fix option name
This commit is contained in:
Andrey Pokhilko
2022-08-24 14:42:20 +03:00
committed by GitHub
parent 925cfa77dd
commit d9a88feb7b
8 changed files with 249 additions and 19 deletions

View File

@@ -6,14 +6,21 @@ import (
log "github.com/sirupsen/logrus"
"net/http"
"os"
"strings"
)
func StartServer() (string, ControlChan) {
data := DataLayer{}
data.CheckConnectivity()
err := data.CheckConnectivity()
if err != nil {
log.Errorf("Failed to check that Helm is operational, cannot continue. The error was: %s", err)
os.Exit(1) // TODO: propagate error instead?
}
address := os.Getenv("HD_BIND")
if address == "" {
address = "localhost"
}
if os.Getenv("HD_PORT") == "" {
address += ":8080" // TODO: better default port to clash less?
} else {
@@ -24,9 +31,6 @@ func StartServer() (string, ControlChan) {
api := newRouter(abort, data)
done := startBackgroundServer(address, api, abort)
if strings.HasPrefix(address, ":") {
address = "localhost" + address
}
return "http://" + address, done
}