]> git.example.dev Git - binbsis50-sm.git/commitdiff
updated: first parts of the code, flags etc.
author2weiEmu <saalbach.robert@outlook.de>
Mon, 9 Mar 2026 23:36:30 +0000 (00:36 +0100)
committer2weiEmu <saalbach.robert@outlook.de>
Mon, 9 Mar 2026 23:36:30 +0000 (00:36 +0100)
.gitignore [new file with mode: 0644]
Makefile [new file with mode: 0644]
README.md
go.mod [new file with mode: 0644]
go.sum [new file with mode: 0644]
main.go [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..26618f0
--- /dev/null
@@ -0,0 +1 @@
+log/sm.log
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..e2c442d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+
+
+default: .
+       go run .
index 36c976b4a592f16bd579a82cc4957ba837b8d57a..a03aaec79312482264d52df3b7a38fe702f8cc88 100644 (file)
--- a/README.md
+++ b/README.md
@@ -21,6 +21,8 @@ Seeing as this is just supposed to be a simple local site used in the house, und
 
 # Flags
 
+- port
+    The port you want to host this on, definitely required.
 - binb_location=[location of binb sis50]
     We need this so we know where to run the scripts
 - songs_location=[the location of the public songs directory]
diff --git a/go.mod b/go.mod
new file mode 100644 (file)
index 0000000..904ba56
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,5 @@
+module songmanager
+
+go 1.25.0
+
+require golang.org/x/net v0.51.0
diff --git a/go.sum b/go.sum
new file mode 100644 (file)
index 0000000..ddf8620
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,4 @@
+golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo=
+golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y=
+golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
+golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
diff --git a/main.go b/main.go
new file mode 100644 (file)
index 0000000..0a0da9e
--- /dev/null
+++ b/main.go
@@ -0,0 +1,40 @@
+package main
+
+import (
+       "flag"
+       "fmt"
+       "log"
+       "os"
+)
+
+func main() {
+       // Getting the parameters
+       paramPort := flag.Int("port", 8000, "Specify the port you want to host this server on. By default: 8000")
+       paramBinbLocation := flag.String("binb_location", "", "Specify the folder containing the app.js for the binb version you are running")
+       paramSongsLocation := flag.String("song_location", "", "Specify the /public/songs folder where the m4a preview files should be saved.")
+       paramRedisLocation := flag.String("redis_location", "", "Specify the location of the redis instance to open, probably a localhost place.")
+       paramContainerName := flag.String("container_name", "", "Specify the name of the container image that would have to be started / restarted")
+
+       flag.Parse()
+
+       // Setting up logging
+       logFile, err := os.OpenFile("./log/sm.log", os.O_APPEND | os.O_RDWR, 0664)
+       if err != nil {
+               fmt.Println("While setting up the server, it could not open the main log file at log/sm.log.", err)
+               panic("Failed to open log file.");
+       }
+
+       defer logFile.Close()
+
+       mainLogger := log.New(logFile, "", log.LstdFlags | log.Lshortfile | log.Ldate | log.Ltime)
+       mainLogger.Println("=== Logging has begun. === ")
+       mainLogger.Println("Given port:", paramPort)
+       mainLogger.Println("Given binb_location:", paramBinbLocation)
+       mainLogger.Println("Given songs_location:", paramSongsLocation)
+       mainLogger.Println("Given redis_location:", paramRedisLocation)
+       mainLogger.Println("Given container_name:", paramContainerName)
+
+
+       // Setting up the routing
+       
+}