Add Basic Websocket Server/Worker Connection
This commit is contained in:
parent
01e34936e9
commit
9ac9ed8fe2
9 changed files with 218 additions and 7 deletions
22
main.go
22
main.go
|
@ -1,31 +1,39 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log/slog"
|
||||
"os"
|
||||
|
||||
"git.lastassault.de/speatzle/morffix/config"
|
||||
"git.lastassault.de/speatzle/morffix/server"
|
||||
"git.lastassault.de/speatzle/morffix/worker"
|
||||
"github.com/BurntSushi/toml"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Server bool
|
||||
}
|
||||
|
||||
var conf Config
|
||||
var conf config.Config
|
||||
|
||||
func main() {
|
||||
slog.Info("Starting...")
|
||||
|
||||
isserver := flag.Bool("server", false, "Run as Server")
|
||||
flag.Parse()
|
||||
confPath := "config.toml"
|
||||
_, err := os.Stat(confPath)
|
||||
if err != nil {
|
||||
confPath = "/etc/morffix/config.toml"
|
||||
}
|
||||
|
||||
slog.Info("Loading Config", "path", confPath)
|
||||
_, err = toml.DecodeFile(confPath, &conf)
|
||||
if err != nil {
|
||||
slog.Error("Error Loading Config", "err", err)
|
||||
return
|
||||
}
|
||||
|
||||
if *isserver {
|
||||
slog.Info("Starting Server...")
|
||||
server.Start(conf)
|
||||
} else {
|
||||
slog.Info("Starting Worker...")
|
||||
worker.Start(conf)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue