|
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 | import { |
6 | 6 | FrontendStorage, |
| 7 | + FrontendStorageBindingsConfig, |
7 | 8 | FrontendStorageDependency, |
8 | 9 | Types as CoreTypes, |
9 | 10 | } from "@itwin/object-storage-core/lib/frontend"; |
| 11 | +import { FrontendUrlTransferClient } from "@itwin/object-storage-core/lib/frontend/internal"; |
10 | 12 |
|
11 | 13 | import { DIContainer } from "@itwin/cloud-agnostic-core"; |
12 | 14 |
|
13 | | -import { Constants } from "../common"; |
| 15 | +import { Constants, Types } from "../common"; |
14 | 16 |
|
15 | 17 | import { AzureFrontendStorage } from "./AzureFrontendStorage"; |
16 | 18 | import { FrontendBlockBlobClientWrapperFactory } from "./wrappers"; |
17 | 19 |
|
18 | 20 | export class AzureFrontendStorageBindings extends FrontendStorageDependency { |
19 | 21 | public readonly dependencyName: string = Constants.storageType; |
20 | 22 |
|
21 | | - public override register(container: DIContainer): void { |
| 23 | + public override register( |
| 24 | + container: DIContainer, |
| 25 | + config?: FrontendStorageBindingsConfig |
| 26 | + ): void { |
| 27 | + container.registerInstance<FrontendStorageBindingsConfig>( |
| 28 | + Types.AzureFrontend.config, |
| 29 | + config ?? { dependencyName: Constants.storageType } |
| 30 | + ); |
| 31 | + container.registerFactory<FrontendUrlTransferClient>( |
| 32 | + CoreTypes.Frontend.urlTransferClient, |
| 33 | + (c: DIContainer) => |
| 34 | + new FrontendUrlTransferClient( |
| 35 | + c.resolve<FrontendStorageBindingsConfig>( |
| 36 | + Types.AzureFrontend.config |
| 37 | + ).retryOptions |
| 38 | + ) |
| 39 | + ); |
22 | 40 | container.registerFactory<FrontendBlockBlobClientWrapperFactory>( |
23 | 41 | CoreTypes.Frontend.clientWrapperFactory, |
24 | | - () => new FrontendBlockBlobClientWrapperFactory() |
| 42 | + (c: DIContainer) => |
| 43 | + new FrontendBlockBlobClientWrapperFactory( |
| 44 | + c.resolve<FrontendStorageBindingsConfig>( |
| 45 | + Types.AzureFrontend.config |
| 46 | + ).retryOptions |
| 47 | + ) |
25 | 48 | ); |
26 | 49 | container.registerFactory<FrontendStorage>( |
27 | 50 | CoreTypes.Frontend.frontendStorage, |
|
0 commit comments