Skip to content

Commit

Permalink
Fix local mode (#7570)
Browse files Browse the repository at this point in the history
AzureClient is currently broken when talking to a local server because our tinylicious service does not support whole summary uploads.

This change ensures we create the correct driver depending on what service we are talking to.
  • Loading branch information
skylerjokiel authored Sep 23, 2021
1 parent 5e61a17 commit c7ed2fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions api-report/azure-client.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export { ITokenResponse }

export { IUser }

// @public
export const LOCAL_MODE_TENANT_ID = "local";

export { ScopeType }


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
AzureClient,
AzureConnectionConfig,
AzureContainerServices,
LOCAL_MODE_TENANT_ID,
} from "@fluidframework/azure-client";
import { InsecureTokenProvider } from "@fluidframework/test-client-utils";
import {
Expand Down Expand Up @@ -47,7 +48,7 @@ const connectionConfig: AzureConnectionConfig = useAzure ? {
orderer: "",
storage: "",
} : {
tenantId: "local",
tenantId: LOCAL_MODE_TENANT_ID,
tokenProvider: new InsecureTokenProvider("fooBar", user),
orderer: "http://localhost:7070",
storage: "http://localhost:7070",
Expand Down
10 changes: 9 additions & 1 deletion packages/framework/azure-client/src/AzureClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ import {
import { AzureAudience } from "./AzureAudience";
import { AzureUrlResolver, createAzureCreateNewRequest } from "./AzureUrlResolver";

/**
* Strongly typed id for connecting to a local Azure Fluid Relay service
*/
export const LOCAL_MODE_TENANT_ID = "local";

/**
* AzureClient provides the ability to have a Fluid object backed by the Azure Relay Service or,
* when running with local tenantId, have it be backed by a Tinylicious local service instance
Expand All @@ -43,9 +48,12 @@ export class AzureClient {
this.props.connection.orderer,
this.props.connection.storage,
);
// The local service implementation differs from the Azure Fluid Relay service in blob
// storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.
const enableWholeSummaryUpload = this.props.connection.tenantId !== LOCAL_MODE_TENANT_ID;
this.documentServiceFactory = new RouterliciousDocumentServiceFactory(
this.props.connection.tokenProvider,
{ enableWholeSummaryUpload: true },
{ enableWholeSummaryUpload },
);
}

Expand Down

0 comments on commit c7ed2fd

Please sign in to comment.