58 lines
2.1 KiB
Go
58 lines
2.1 KiB
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"approveflow/app/console"
|
||
|
"approveflow/app/http"
|
||
|
appInfrastructure "approveflow/app/infrastructure"
|
||
|
"approveflow/app/provider"
|
||
|
"github.com/Superdanda/hade/framework"
|
||
|
"github.com/Superdanda/hade/framework/provider/app"
|
||
|
"github.com/Superdanda/hade/framework/provider/cache"
|
||
|
"github.com/Superdanda/hade/framework/provider/config"
|
||
|
"github.com/Superdanda/hade/framework/provider/distributed"
|
||
|
"github.com/Superdanda/hade/framework/provider/env"
|
||
|
"github.com/Superdanda/hade/framework/provider/infrastructure"
|
||
|
"github.com/Superdanda/hade/framework/provider/kernel"
|
||
|
"github.com/Superdanda/hade/framework/provider/log"
|
||
|
"github.com/Superdanda/hade/framework/provider/orm"
|
||
|
"github.com/Superdanda/hade/framework/provider/redis"
|
||
|
"github.com/Superdanda/hade/framework/provider/repository"
|
||
|
"github.com/Superdanda/hade/framework/provider/ssh"
|
||
|
"github.com/Superdanda/hade/framework/provider/type_register"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
// 初始化服务容器
|
||
|
container := framework.NewHadeContainer()
|
||
|
// 绑定App服务提供者
|
||
|
container.Bind(&app.HadeAppProvider{})
|
||
|
// 后续初始化需要绑定的服务提供者...
|
||
|
container.Bind(&env.HadeEnvProvider{})
|
||
|
container.Bind(&distributed.LocalDistributedProvider{})
|
||
|
container.Bind(&config.HadeConfigProvider{})
|
||
|
//container.Bind(&id.HadeIDProvider{})
|
||
|
//container.Bind(&trace.HadeTraceProvider{})
|
||
|
container.Bind(&log.HadeLogServiceProvider{})
|
||
|
container.Bind(&orm.GormProvider{})
|
||
|
container.Bind(&redis.RedisProvider{})
|
||
|
container.Bind(&cache.HadeCacheProvider{})
|
||
|
container.Bind(&ssh.SSHProvider{})
|
||
|
container.Bind(&type_register.TypeRegisterProvider{})
|
||
|
container.Bind(&infrastructure.InfrastructureProvider{})
|
||
|
container.Bind(&repository.RepositoryProvider{})
|
||
|
|
||
|
// 将HTTP引擎初始化,并且作为服务提供者绑定到服务容器中
|
||
|
if engine, err := http.NewHttpEngine(container); err == nil {
|
||
|
container.Bind(&kernel.HadeKernelProvider{HttpEngine: engine})
|
||
|
}
|
||
|
|
||
|
// 应用层服务提供绑定
|
||
|
provider.BindAppProvider(container)
|
||
|
|
||
|
// 应用层注册基础设施实现
|
||
|
appInfrastructure.NewOrmRepositoryAndRegister(container)
|
||
|
|
||
|
// 运行root命令
|
||
|
console.RunCommand(container)
|
||
|
}
|