mirror of
https://github.com/OliveTin/OliveTin
synced 2025-12-12 17:15:37 +00:00
gofmt
This commit is contained in:
@@ -8,9 +8,9 @@ import (
|
|||||||
|
|
||||||
"github.com/jamesread/OliveTin/internal/httpservers"
|
"github.com/jamesread/OliveTin/internal/httpservers"
|
||||||
|
|
||||||
|
"github.com/fsnotify/fsnotify"
|
||||||
config "github.com/jamesread/OliveTin/internal/config"
|
config "github.com/jamesread/OliveTin/internal/config"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"github.com/fsnotify/fsnotify"
|
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ func init() {
|
|||||||
|
|
||||||
cfg = config.DefaultConfig()
|
cfg = config.DefaultConfig()
|
||||||
|
|
||||||
reloadConfig();
|
reloadConfig()
|
||||||
|
|
||||||
if logLevel, err := log.ParseLevel(cfg.LogLevel); err == nil {
|
if logLevel, err := log.ParseLevel(cfg.LogLevel); err == nil {
|
||||||
log.SetLevel(logLevel)
|
log.SetLevel(logLevel)
|
||||||
@@ -55,7 +55,7 @@ func init() {
|
|||||||
if e.Op == fsnotify.Write {
|
if e.Op == fsnotify.Write {
|
||||||
log.Info("Config file changed:", e.String())
|
log.Info("Config file changed:", e.String())
|
||||||
|
|
||||||
reloadConfig();
|
reloadConfig()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ func execAction(cfg *config.Config, actualAction *config.ActionButton) *pb.Start
|
|||||||
"timeout": actualAction.Timeout,
|
"timeout": actualAction.Timeout,
|
||||||
}).Infof("Found action")
|
}).Infof("Found action")
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(actualAction.Timeout) * time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(actualAction.Timeout)*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, "sh", "-c", actualAction.Shell)
|
cmd := exec.CommandContext(ctx, "sh", "-c", actualAction.Shell)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ func findWebuiDir() string {
|
|||||||
return "./webui" // Should not exist
|
return "./webui" // Should not exist
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateWebUiSettings(w http.ResponseWriter, r *http.Request) {
|
func generateWebUISettings(w http.ResponseWriter, r *http.Request) {
|
||||||
restAddress := ""
|
restAddress := ""
|
||||||
|
|
||||||
if !cfg.UseSingleHTTPFrontend {
|
if !cfg.UseSingleHTTPFrontend {
|
||||||
@@ -56,7 +56,7 @@ func startWebUIServer(cfg *config.Config) {
|
|||||||
|
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.Handle("/", http.FileServer(http.Dir(findWebuiDir())))
|
mux.Handle("/", http.FileServer(http.Dir(findWebuiDir())))
|
||||||
mux.HandleFunc("/webUiSettings.json", generateWebUiSettings)
|
mux.HandleFunc("/webUiSettings.json", generateWebUISettings)
|
||||||
|
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
Addr: cfg.ListenAddressWebUI,
|
Addr: cfg.ListenAddressWebUI,
|
||||||
|
|||||||
Reference in New Issue
Block a user