github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/tests/system/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 localMigrations "github.com/e154/smart-home/system/initial/local_migrations" 32 "github.com/e154/smart-home/system/jwt_manager" 33 "github.com/e154/smart-home/system/logging" 34 "github.com/e154/smart-home/system/logging_db" 35 "github.com/e154/smart-home/system/migrations" 36 "github.com/e154/smart-home/system/mqtt" 37 "github.com/e154/smart-home/system/mqtt_authenticator" 38 "github.com/e154/smart-home/system/orm" 39 "github.com/e154/smart-home/system/scheduler" 40 "github.com/e154/smart-home/system/scripts" 41 "github.com/e154/smart-home/system/storage" 42 "github.com/e154/smart-home/system/stream" 43 "github.com/e154/smart-home/system/supervisor" 44 "github.com/e154/smart-home/system/validation" 45 "github.com/e154/smart-home/system/zigbee2mqtt" 46 "go.uber.org/dig" 47 "go.uber.org/fx" 48 ) 49 50 // BuildContainer ... 51 func BuildContainer() (container *dig.Container) { 52 53 container = dig.New() 54 _ = container.Provide(ReadConfig) 55 _ = container.Provide(validation.NewValidate) 56 _ = container.Provide(web.New) 57 _ = container.Provide(NewOrmConfig) 58 _ = container.Provide(orm.NewOrm) 59 _ = container.Provide(NewMigrationsConfig) 60 _ = container.Provide(migrations.NewMigrations) 61 _ = container.Provide(adaptors.NewAdaptors) 62 _ = container.Provide(scheduler.NewScheduler) 63 _ = container.Provide(scripts.NewScriptService) 64 _ = container.Provide(MigrationList) 65 _ = container.Provide(localMigrations.NewMigrations) 66 _ = container.Provide(initial.NewInitial) 67 _ = container.Provide(NewBackupConfig) 68 _ = container.Provide(backup.NewBackup) 69 _ = container.Provide(NewMqttConfig) 70 _ = container.Provide(mqtt.NewMqtt) 71 _ = container.Provide(mqtt_authenticator.NewAuthenticator) 72 _ = container.Provide(access_list.NewAccessListService) 73 _ = container.Provide(stream.NewStreamService) 74 _ = container.Provide(client.NewGateClient) 75 _ = container.Provide(NewZigbee2mqttConfig) 76 _ = container.Provide(zigbee2mqtt.NewZigbee2mqtt) 77 _ = container.Provide(NewLoggerConfig) 78 _ = container.Provide(logging.NewLogger) 79 _ = container.Provide(logging_db.NewLogDbSaver) 80 _ = container.Provide(storage.NewStorage) 81 _ = container.Provide(supervisor.NewSupervisor) 82 _ = container.Provide(automation.NewAutomation) 83 _ = container.Provide(bus.NewBus) 84 _ = container.Provide(endpoint.NewCommonEndpoint) 85 _ = container.Provide(endpoint.NewEndpoint) 86 _ = container.Provide(jwt_manager.NewJwtManager) 87 _ = container.Provide(func() (lc fx.Lifecycle) { 88 return &FxNull{} 89 }) 90 91 return 92 }