File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -34,17 +34,21 @@ func RegisterService(service Service) {
3434 serviceMap [service .GetName ()] = service
3535}
3636
37- func RegisterApi (engine * gin.Engine ) {
38- log .Println ("client: register api" )
39-
40- if httpHandler != nil {
41- panic ("client: api already registered" )
37+ func StartApp (args ... any ) {
38+ if len (args ) > 1 {
39+ panic (errors .New ("client: invalid start app arguments" ))
4240 }
4341
44- httpHandler = engine
45- }
42+ if len (args ) > 0 {
43+ g , ok := args [0 ].(* gin.Engine )
44+ if ! ok {
45+ panic (errors .New ("client: invalid start app arguments" ))
46+ }
47+
48+ log .Println ("client: register api" )
49+ httpHandler = g
50+ }
4651
47- func StartApp () {
4852 if len (os .Args ) > 1 {
4953 log .Println ("client: run cli command" )
5054 err := runCliCommand (os .Args [1 :])
You can’t perform that action at this time.
0 commit comments