2024-10-16 16:53:09 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-10-19 22:02:19 +08:00
|
|
|
"github.com/Superdanda/hade/app/console"
|
|
|
|
"github.com/Superdanda/hade/app/http"
|
|
|
|
"github.com/Superdanda/hade/framework"
|
|
|
|
"github.com/Superdanda/hade/framework/provider/app"
|
2024-10-24 16:15:06 +08:00
|
|
|
"github.com/Superdanda/hade/framework/provider/cache"
|
2024-10-20 22:56:46 +08:00
|
|
|
"github.com/Superdanda/hade/framework/provider/config"
|
|
|
|
"github.com/Superdanda/hade/framework/provider/distributed"
|
|
|
|
"github.com/Superdanda/hade/framework/provider/env"
|
2024-10-19 22:02:19 +08:00
|
|
|
"github.com/Superdanda/hade/framework/provider/kernel"
|
2024-10-20 22:56:46 +08:00
|
|
|
"github.com/Superdanda/hade/framework/provider/log"
|
2024-10-23 17:00:42 +08:00
|
|
|
"github.com/Superdanda/hade/framework/provider/orm"
|
2024-10-24 16:15:06 +08:00
|
|
|
"github.com/Superdanda/hade/framework/provider/redis"
|
|
|
|
"github.com/Superdanda/hade/framework/provider/ssh"
|
2024-10-27 17:54:21 +08:00
|
|
|
"github.com/Superdanda/hade/framework/provider/type_register"
|
2024-10-16 16:53:09 +08:00
|
|
|
)
|
|
|
|
|
2024-10-19 22:02:19 +08:00
|
|
|
func main() {
|
|
|
|
// 初始化服务容器
|
|
|
|
container := framework.NewHadeContainer()
|
|
|
|
// 绑定App服务提供者
|
|
|
|
container.Bind(&app.HadeAppProvider{})
|
|
|
|
// 后续初始化需要绑定的服务提供者...
|
2024-10-20 22:56:46 +08:00
|
|
|
container.Bind(&env.HadeEnvProvider{})
|
|
|
|
container.Bind(&distributed.LocalDistributedProvider{})
|
|
|
|
container.Bind(&config.HadeConfigProvider{})
|
|
|
|
//container.Bind(&id.HadeIDProvider{})
|
|
|
|
//container.Bind(&trace.HadeTraceProvider{})
|
|
|
|
container.Bind(&log.HadeLogServiceProvider{})
|
2024-10-23 17:00:42 +08:00
|
|
|
container.Bind(&orm.GormProvider{})
|
2024-10-24 16:15:06 +08:00
|
|
|
container.Bind(&redis.RedisProvider{})
|
|
|
|
container.Bind(&cache.HadeCacheProvider{})
|
|
|
|
container.Bind(&ssh.SSHProvider{})
|
2024-10-27 17:54:21 +08:00
|
|
|
container.Bind(&type_register.TypeRegisterProvider{})
|
2024-10-19 22:02:19 +08:00
|
|
|
|
|
|
|
// 将HTTP引擎初始化,并且作为服务提供者绑定到服务容器中
|
2024-10-23 17:00:42 +08:00
|
|
|
if engine, err := http.NewHttpEngine(container); err == nil {
|
2024-10-19 22:02:19 +08:00
|
|
|
container.Bind(&kernel.HadeKernelProvider{HttpEngine: engine})
|
2024-10-18 14:41:55 +08:00
|
|
|
}
|
2024-10-20 22:56:46 +08:00
|
|
|
|
|
|
|
// 运行root命令
|
2024-10-19 22:02:19 +08:00
|
|
|
console.RunCommand(container)
|
2024-10-16 16:53:09 +08:00
|
|
|
}
|