()
| 149 | } |
| 150 | |
| 151 | public Run(): void { |
| 152 | if (!this.IsDataMounted()) { |
| 153 | Logger.Get.Log('\'/app/data\' folder doesn\'t exist. Maybe forgot to mount it'); |
| 154 | process.exit(1); |
| 155 | } |
| 156 | |
| 157 | this.db = new Sqlite3(DB_LOCATION); |
| 158 | this.storage = new SqliteAdapter(this.db); |
| 159 | |
| 160 | |
| 161 | if (!this.storage.IsInitialized()) { |
| 162 | Logger.Get.Log('Database doesn\'t initialized or malformed. Initialization...'); |
| 163 | this.InitializeDb(); |
| 164 | } |
| 165 | |
| 166 | this.settings = new Settings(this.storage); |
| 167 | |
| 168 | Logger.Get.AddWriter(new SqliteWriter(this.storage)); |
| 169 | |
| 170 | try { |
| 171 | this.PrepareFileSystem(); |
| 172 | } catch (e) { |
| 173 | Logger.Get.Log(`Preparing filesystem error. ${e}`); |
| 174 | process.exit(1); |
| 175 | } |
| 176 | |
| 177 | this.notificationCenter = new NotificationCenter(this.storage); |
| 178 | |
| 179 | this.LoadData(); |
| 180 | |
| 181 | process.on('SIGTERM', () => { |
| 182 | Logger.Get.Log('SIGTERM received'); |
| 183 | this.Shutdown(); |
| 184 | }); |
| 185 | |
| 186 | this.io.on('connection', socket => { |
| 187 | Logger.Get.Log(`[${socket.id}][${socket.request.connection.remoteAddress}] client connected`); |
| 188 | new RpcRequestHandlerImpl( |
| 189 | socket, |
| 190 | this.broadcaster, |
| 191 | this.observables, |
| 192 | this.pluginManager, |
| 193 | this.pluginManagerController, |
| 194 | this.pluginManagerListener, |
| 195 | this.storage, |
| 196 | this.linkedStreams, |
| 197 | this.archive, |
| 198 | this.archiveRefCounter, |
| 199 | this.clipProgress, |
| 200 | this.archiveFilters, |
| 201 | this.observablesFilters, |
| 202 | this.recorder, |
| 203 | this.systemResourcesMonitor, |
| 204 | this.notificationCenter, |
| 205 | this.settings, |
| 206 | this.facade, |
| 207 | () => this.Shutdown()); |
| 208 |
no test coverage detected