-
Notifications
You must be signed in to change notification settings - Fork 0
/
Run.ts
36 lines (31 loc) · 1.28 KB
/
Run.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import {
DependenciesConfig,
Types as DependencyTypes,
} from "@itwin/cloud-agnostic-core";
import { AzureClientStorageBindings } from "@itwin/object-storage-azure";
import { App } from "./App";
/**
* This function starts the application by first creating an instance of it and
* then configuring its container by binding `DependenciesConfig` to a specific
* value and `ClientStorage` to a specific implementation (in this case,
* `AzureClientStorage` class). This allows the `App` class to be unaware of any
* specific cloud providers and rely that it will get some type of
* `ClientStorage`.
*/
async function run(): Promise<void> {
const app = new App();
app.container
.bind<DependenciesConfig>(DependencyTypes.dependenciesConfig)
.toConstantValue({
ClientStorage: {
dependencyName: "azure",
},
});
app.useBindings(AzureClientStorageBindings);
return app.start();
}
run().catch((err) => console.error(err));