zdravko/cmd/temporal/main.go

53 lines
945 B
Go
Raw Normal View History

2024-02-13 10:47:57 +00:00
package main
import (
"log"
"code.tjo.space/mentos1386/zdravko/internal"
2024-02-13 10:47:57 +00:00
t "code.tjo.space/mentos1386/zdravko/pkg/temporal"
)
func backendServer(config *internal.Config) {
serverConfig := t.NewServerConfig(config)
2024-02-13 10:47:57 +00:00
server, err := t.NewServer(serverConfig)
if err != nil {
log.Fatalf("Unable to create server: %v", err)
2024-02-13 10:47:57 +00:00
}
err = server.Start()
2024-02-13 10:47:57 +00:00
if err != nil {
log.Fatalf("Unable to start server: %v", err)
2024-02-13 10:47:57 +00:00
}
err = server.Stop()
2024-02-13 10:47:57 +00:00
if err != nil {
log.Fatalf("Unable to stop server: %v", err)
2024-02-13 10:47:57 +00:00
}
}
2024-02-13 10:47:57 +00:00
func frontendServer(config *internal.Config) {
uiConfig := t.NewUiConfig(config)
2024-02-13 10:47:57 +00:00
uiServer, err := t.NewUiServer(uiConfig)
2024-02-13 10:47:57 +00:00
if err != nil {
log.Fatalf("Unable to create UI server: %v", err)
2024-02-13 10:47:57 +00:00
}
err = uiServer.Start()
2024-02-13 10:47:57 +00:00
if err != nil {
log.Fatalf("Unable to start UI server: %v", err)
2024-02-13 10:47:57 +00:00
}
uiServer.Stop()
2024-02-13 10:47:57 +00:00
}
func main() {
config := internal.NewConfig()
2024-02-13 10:47:57 +00:00
go func() {
frontendServer(config)
2024-02-13 10:47:57 +00:00
}()
backendServer(config)
2024-02-13 10:47:57 +00:00
}