update
parent
54d2ff474a
commit
18edc740ee
|
@ -0,0 +1,31 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"github.com/spf13/viper"
|
||||
"kumoly.io/kumoly/app/auth"
|
||||
"kumoly.io/kumoly/app/control"
|
||||
"kumoly.io/kumoly/app/email"
|
||||
"kumoly.io/kumoly/app/history"
|
||||
"kumoly.io/kumoly/app/server"
|
||||
"kumoly.io/kumoly/app/store"
|
||||
"kumoly.io/kumoly/app/system"
|
||||
"kumoly.io/kumoly/app/task"
|
||||
)
|
||||
|
||||
func Default() *system.System {
|
||||
store.Setup()
|
||||
sys := system.New()
|
||||
server := server.New(viper.GetString("name"))
|
||||
|
||||
auth.Setup()
|
||||
auth.SetDB(store.DB)
|
||||
|
||||
sys.Inject(auth.Injector(server.API))
|
||||
sys.Append(server, auth.New(server),
|
||||
&task.Service{},
|
||||
&history.Service{},
|
||||
&email.Service{},
|
||||
&control.Service{},
|
||||
)
|
||||
return sys
|
||||
}
|
24
main_test.go
24
main_test.go
|
@ -2,32 +2,10 @@ package app
|
|||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"kumoly.io/kumoly/app/auth"
|
||||
"kumoly.io/kumoly/app/control"
|
||||
"kumoly.io/kumoly/app/email"
|
||||
"kumoly.io/kumoly/app/history"
|
||||
"kumoly.io/kumoly/app/server"
|
||||
"kumoly.io/kumoly/app/store"
|
||||
"kumoly.io/kumoly/app/system"
|
||||
"kumoly.io/kumoly/app/task"
|
||||
)
|
||||
|
||||
func TestMain(t *testing.T) {
|
||||
store.Setup()
|
||||
sys := system.New()
|
||||
server := server.New("app")
|
||||
|
||||
auth.Setup()
|
||||
auth.SetDB(store.DB)
|
||||
|
||||
sys.Inject(auth.Injector(server.API))
|
||||
sys.Append(server, auth.New(server),
|
||||
&task.Service{},
|
||||
&history.Service{},
|
||||
&email.Service{},
|
||||
&control.Service{},
|
||||
)
|
||||
sys := Default()
|
||||
go sys.Start()
|
||||
|
||||
<-sys.Done()
|
||||
|
|
Loading…
Reference in New Issue