(configuration?: TableConfiguration)
| 31 | private readonly /* Store the account data */ accountDataStore: IAccountDataStore; |
| 32 | |
| 33 | constructor(configuration?: TableConfiguration) { |
| 34 | // If configuration is undefined, we'll use the default one |
| 35 | if (configuration === undefined) { |
| 36 | configuration = new TableConfiguration(); |
| 37 | } |
| 38 | |
| 39 | // Create a http server to accept table operation request |
| 40 | let httpServer; |
| 41 | const certOption = configuration.hasCert(); |
| 42 | switch (certOption) { |
| 43 | case CertOptions.PEM: |
| 44 | case CertOptions.PFX: |
| 45 | httpServer = https.createServer(configuration.getCert(certOption)!); |
| 46 | break; |
| 47 | default: |
| 48 | httpServer = http.createServer(); |
| 49 | } |
| 50 | |
| 51 | // Create **dataStore with Loki.js |
| 52 | const metadataStore: ITableMetadataStore = new LokiTableMetadataStore( |
| 53 | configuration.metadataDBPath, |
| 54 | configuration.isMemoryPersistence |
| 55 | ); |
| 56 | const accountDataStore: IAccountDataStore = new AccountDataStore(logger); |
| 57 | |
| 58 | // Here we use express request listener and register table handler |
| 59 | const requestListenerFactory: IRequestListenerFactory = new TableRequestListenerFactory( |
| 60 | metadataStore, |
| 61 | accountDataStore, |
| 62 | configuration.enableAccessLog, // Access log includes every handled HTTP request |
| 63 | configuration.accessLogWriteStream, |
| 64 | configuration.skipApiVersionCheck, |
| 65 | configuration.getOAuthLevel(), |
| 66 | configuration.disableProductStyleUrl |
| 67 | ); |
| 68 | |
| 69 | const host = configuration.host; |
| 70 | const port = configuration.port; |
| 71 | super(host, port, httpServer, requestListenerFactory, configuration); |
| 72 | |
| 73 | this.metadataStore = metadataStore; |
| 74 | this.accountDataStore = accountDataStore; |
| 75 | } |
| 76 | |
| 77 | public async clean(): Promise<void> { |
| 78 | if (this.getStatus() === ServerStatus.Closed) { |
nothing calls this directly
no test coverage detected