Files
tavern/main.go

47 lines
1014 B
Go
Raw Normal View History

2023-05-24 16:10:00 +09:00
// warroom project main.go
package main
import (
"context"
"net/http"
2023-06-21 14:38:26 +09:00
"repositories.action2quare.com/ayo/gocommon/flagx"
2023-05-24 16:10:00 +09:00
"repositories.action2quare.com/ayo/gocommon/wshandler"
"repositories.action2quare.com/ayo/tavern/core"
common "repositories.action2quare.com/ayo/gocommon"
"repositories.action2quare.com/ayo/gocommon/logger"
)
2023-06-21 14:38:26 +09:00
var prefix = flagx.String("prefix", "", "")
2023-05-24 16:10:00 +09:00
func main() {
2023-06-21 16:21:19 +09:00
flagx.Parse()
2023-05-24 16:10:00 +09:00
ctx, cancel := context.WithCancel(context.Background())
var config core.TavernConfig
if err := common.LoadConfig(&config); err != nil {
panic(err)
}
Squashed commit of the following: commit 8e1b232d57801c12edb94d02038b663d19c67b9b Author: mountain <mountain@action2quare.com> Date: Wed Jul 19 09:37:02 2023 +0900 InMemory 그룹을 redis로 변경 commit 01da5bb3a4b2c1857ce73d5722add85d347c976d Author: mountain <mountain@action2quare.com> Date: Tue Jul 18 01:31:39 2023 +0900 body를 marshaling하고 클라이언트에서 flatten함 commit ba61a11659eb790d98d41ce61d38dd001ccfa56c Author: mountain <mountain@action2quare.com> Date: Mon Jul 17 17:47:07 2023 +0900 gob 등록 commit 67cca13326aa517ba0de396b8d5bce736c1c86d8 Author: mountain <mountain@action2quare.com> Date: Sun Jul 16 18:41:24 2023 +0900 모듈 업데이트 commit 272c696c59652452da45e2704eabebc1e5f587a8 Author: mountain <mountain@action2quare.com> Date: Sun Jul 16 17:29:21 2023 +0900 json value 다시 되돌림 commit aa568ec3fa0016b4a1a43b29c578720ff65883c1 Author: mountain <mountain@action2quare.com> Date: Sun Jul 16 17:26:19 2023 +0900 SetOption 타입 변경 commit b9c4d8b21bbe47733f3bc061973743de06ce3b64 Author: mountain <mountain@action2quare.com> Date: Sun Jul 16 17:15:08 2023 +0900 objvalue marshalling 수정 commit 99834c146182cf51cbe4a24915f14c91208be994 Author: mountain <mountain@action2quare.com> Date: Sun Jul 16 17:01:06 2023 +0900 objlen 수정 commit 592112219ec5333031b56949d85e91ce5e46bf20 Author: mountain <mountain@action2quare.com> Date: Sun Jul 16 16:38:05 2023 +0900 gocommon 업데이트 commit 62485b6d54e7f8394272b1b80778f677b0fc5996 Author: mountain <mountain@action2quare.com> Date: Sun Jul 16 15:36:20 2023 +0900 redis json 마이그레이션 완료 commit d36dd13bb7b5c70825cae3ca5ea4d3cb62506ab6 Author: mountain <mountain@action2quare.com> Date: Sun Jul 16 02:51:41 2023 +0900 redis stack 사용
2023-07-19 09:37:40 +09:00
wsh, err := wshandler.NewWebsocketHandler()
2023-05-24 16:10:00 +09:00
if err != nil {
panic(err)
}
if tv, err := core.New(ctx, wsh, &config); err != nil {
panic(err)
} else {
serveMux := http.NewServeMux()
2023-07-10 15:39:56 +09:00
wsh.RegisterHandlers(serveMux, *prefix)
2023-06-21 14:38:26 +09:00
tv.RegisterHandlers(ctx, serveMux, *prefix)
2023-05-24 16:10:00 +09:00
server := common.NewHTTPServer(serveMux)
logger.Println("tavern is started")
2023-07-10 15:39:56 +09:00
wsh.Start(ctx)
2023-05-24 16:10:00 +09:00
server.Start()
cancel()
2023-07-10 15:39:56 +09:00
tv.Cleanup()
wsh.Cleanup()
2023-05-24 16:10:00 +09:00
}
}