feat: Implement WebSocket-based SSH terminal functionality and refactor the frontend using the Tabler.io framework.
Build Docker Container using Multistage Build / build (push) Failing after 4m17s

This commit is contained in:
Matthias Hinrichs
2026-02-18 00:38:31 +01:00
parent f088a6fba9
commit e68e355e3f
9 changed files with 1068 additions and 229 deletions
+33 -19
View File
@@ -1,6 +1,7 @@
package main
import (
"flag"
"fmt"
"os"
@@ -11,48 +12,58 @@ import (
)
func main() {
debug := flag.Bool("debug", false, "Enable debug logging")
flag.Parse()
if *debug {
serveractions.Debug = true
serveractions.LogDebug("Debug mode enabled")
}
args := flag.Args()
if len(args) < 1 {
printUsage()
return
}
servers, err := loadConfig()
if err != nil {
fmt.Printf("Error loading servers: %v\n", err)
return
}
serveractions.LogDebug("Loaded %d servers from config", len(servers))
if len(os.Args) < 2 {
printUsage()
return
}
command := os.Args[1]
command := args[0]
switch command {
case "list":
listServers(servers)
case "wake":
if len(os.Args) < 3 {
if len(args) < 2 {
fmt.Println("Please specify a server name to wake.")
printUsage()
return
}
serverName := os.Args[2]
serverName := args[1]
serveractions.WakeServer(serverName, servers)
case "wakeall":
serveractions.WakeAllServers(servers)
case "status":
serveractions.CheckServersStatus(servers)
case "shutdown":
if len(os.Args) < 3 {
if len(args) < 2 {
fmt.Println("Please specify a server name to shutdown.")
printUsage()
return
}
serverName := os.Args[2]
serverName := args[1]
serveractions.ShutdownServer(serverName, servers)
case "reboot":
if len(os.Args) < 3 {
if len(args) < 2 {
fmt.Println("Please specify a server name to reboot.")
printUsage()
return
}
serverName := os.Args[2]
serverName := args[1]
serveractions.RebootServer(serverName, servers)
case "serve":
webserver.StartWebServer(servers)
@@ -63,7 +74,9 @@ func main() {
}
func printUsage() {
fmt.Println("Usage: go run . <command>")
fmt.Println("Usage: go run . [--debug] <command>")
fmt.Println("Options:")
fmt.Println(" --debug - Enable debug logging")
fmt.Println("Commands:")
fmt.Println(" list - List all configured servers")
fmt.Println(" wake <server_name> - Wake a specific server")
@@ -75,14 +88,15 @@ func printUsage() {
}
func loadConfig() ([]serveractions.Server, error) {
viper.SetConfigName("servers") // name of config file (without extension)
viper.SetConfigType("json") // or viper.SetConfigType("YAML")
viper.AddConfigPath("./config") // path to look for the config file in
viper.AddConfigPath(".") // optionally look for config in the working directory
err := viper.ReadInConfig() // Find and read the config file
if err != nil { // Handle errors reading the config file
viper.SetConfigName("servers") // name of config file (without extension)
viper.SetConfigType("json") // or viper.SetConfigType("YAML")
viper.AddConfigPath("./config") // path to look for the config file in
viper.AddConfigPath(".") // optionally look for config in the working directory
err := viper.ReadInConfig() // Find and read the config file
if err != nil { // Handle errors reading the config file
// Check if the error is that the file doesn't exist
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
os.WriteFile("debug_config.log", []byte("Config file not found\n"), 0644)
// Config file not found; ignore error and return empty server list
return []serveractions.Server{}, nil
}