Inital commit

This commit is contained in:
2026-06-24 13:44:39 -04:00
commit f098d5f170
15 changed files with 471 additions and 0 deletions

37
server/container.go Normal file
View File

@@ -0,0 +1,37 @@
package server
import (
"bufio"
"log"
"os"
"strings"
)
func getServerName(dir string) string {
if err := os.Chdir(dir); err != nil {
log.Fatal(err)
}
file, err := os.Open("docker-compose.yml")
if err != nil {
log.Fatal(err)
}
defer file.Close()
scanner := bufio.NewScanner(file)
name := dir
for scanner.Scan() {
txt := scanner.Text()
txt = strings.TrimSpace(txt)
s, found := strings.CutPrefix(txt, "container_name: ")
if found {
name = s
}
}
if err := scanner.Err(); err != nil {
log.Fatal(err)
}
return name
}