Skip to content

Commit

Permalink
DocumentDb: Allow fine-grained customization of underlying client.
Browse files Browse the repository at this point in the history
  • Loading branch information
julienblin committed Sep 19, 2018
1 parent d92843b commit c65190e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- SSMParameterStoreConfigService: Added set method.
- DocumentDb: Added debug mode
- DocumentDb: Exposed underlying client
- DocumentDb: Allow fine-grained customization of underlying client

### Changed
- [BREAKING] Removed maxresults in Azure KeyVaultConfigService options as it is not very useful (blocked at 25 anyway)
Expand Down
8 changes: 7 additions & 1 deletion packages/uno-serverless-azure/src/services/documentdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ export interface DocumentDbImplOptions {
collectionCreationOptions?: Partial<Collection>;
collectionId: string | Promise<string>;
databaseId: string | Promise<string>;
debug?: boolean | Promise<boolean>;
debug?: boolean | Promise<boolean | undefined>;
defaultConsistencyLevel?: ConsistencyLevel;
documentClient?: DocumentClient | Promise<DocumentClient | undefined>;
endpoint: string | Promise<string>;
primaryKey: string | Promise<string>;
}
Expand All @@ -105,6 +106,11 @@ export class DocumentDbImpl implements DocumentDb, CheckHealth {

private readonly lazyClient = lazyAsync(
async () => {
const optionClient = await this.options.documentClient;
if (optionClient) {
return optionClient;
}

return new DocumentClient(
await this.options.endpoint,
{
Expand Down

0 comments on commit c65190e

Please sign in to comment.