github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/tests/models/container/container.go (about) 1 // This file is part of the Smart Home 2 // Program complex distribution https://github.com/e154/smart-home 3 // Copyright (C) 2016-2023, Filippov Alex 4 // 5 // This library is free software: you can redistribute it and/or 6 // modify it under the terms of the GNU Lesser General Public 7 // License as published by the Free Software Foundation; either 8 // version 3 of the License, or (at your option) any later version. 9 // 10 // This library is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 // Library General Public License for more details. 14 // 15 // You should have received a copy of the GNU Lesser General Public 16 // License along with this library. If not, see 17 // <https://www.gnu.org/licenses/>. 18 19 package container 20 21 import ( 22 "github.com/e154/smart-home/adaptors" 23 "github.com/e154/smart-home/common/web" 24 "github.com/e154/smart-home/endpoint" 25 "github.com/e154/smart-home/system/access_list" 26 "github.com/e154/smart-home/system/automation" 27 "github.com/e154/smart-home/system/backup" 28 "github.com/e154/smart-home/system/bus" 29 "github.com/e154/smart-home/system/gate/client" 30 "github.com/e154/smart-home/system/initial" 31 "github.com/e154/smart-home/system/logging" 32 "github.com/e154/smart-home/system/logging_db" 33 "github.com/e154/smart-home/system/migrations" 34 "github.com/e154/smart-home/system/mqtt" 35 "github.com/e154/smart-home/system/mqtt_authenticator" 36 "github.com/e154/smart-home/system/orm" 37 "github.com/e154/smart-home/system/scheduler" 38 "github.com/e154/smart-home/system/scripts" 39 "github.com/e154/smart-home/system/storage" 40 "github.com/e154/smart-home/system/stream" 41 "github.com/e154/smart-home/system/supervisor" 42 "github.com/e154/smart-home/system/zigbee2mqtt" 43 "go.uber.org/dig" 44 "go.uber.org/fx" 45 ) 46 47 // BuildContainer ... 48 func BuildContainer() (container *dig.Container) { 49 50 container = dig.New() 51 _ = container.Provide(ReadConfig) 52 _ = container.Provide(NewOrmConfig) 53 _ = container.Provide(web.New) 54 _ = container.Provide(orm.NewOrm) 55 _ = container.Provide(NewMigrationsConfig) 56 _ = container.Provide(migrations.NewMigrations) 57 _ = container.Provide(adaptors.NewAdaptors) 58 _ = container.Provide(scheduler.NewScheduler) 59 _ = container.Provide(scripts.NewScriptService) 60 _ = container.Provide(initial.NewInitial) 61 _ = container.Provide(NewBackupConfig) 62 _ = container.Provide(backup.NewBackup) 63 _ = container.Provide(NewMqttConfig) 64 _ = container.Provide(mqtt.NewMqtt) 65 _ = container.Provide(mqtt_authenticator.NewAuthenticator) 66 _ = container.Provide(access_list.NewAccessListService) 67 _ = container.Provide(stream.NewStreamService) 68 _ = container.Provide(client.NewGateClient) 69 _ = container.Provide(NewZigbee2mqttConfig) 70 _ = container.Provide(zigbee2mqtt.NewZigbee2mqtt) 71 _ = container.Provide(NewLoggerConfig) 72 _ = container.Provide(logging.NewLogger) 73 _ = container.Provide(logging_db.NewLogDbSaver) 74 _ = container.Provide(storage.NewStorage) 75 _ = container.Provide(supervisor.NewSupervisor) 76 _ = container.Provide(automation.NewAutomation) 77 _ = container.Provide(bus.NewBus) 78 _ = container.Provide(endpoint.NewCommonEndpoint) 79 _ = container.Provide(endpoint.NewEndpoint) 80 _ = container.Provide(func() (lc fx.Lifecycle) { 81 return &FxNull{} 82 }) 83 84 return 85 }