Skip to content

Commit

Permalink
Add cname for session service
Browse files Browse the repository at this point in the history
  • Loading branch information
incorbador committed Jun 6, 2024
1 parent 913affc commit 95592f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class Config implements ConfigInterface {

FrontendAPI: string;

FrontendAPIWithCName: string;

BackendAPI: string = DefaultBackendAPI;

ShortSessionCookieName: string = DefaultShortSessionCookieName;
Expand All @@ -32,14 +34,15 @@ class Config implements ConfigInterface {

CacheMaxAge: number = DefaultCacheMaxAge;

constructor(projectID: string, apiSecret: string) {
constructor(projectID: string, apiSecret: string, cname?: string) {
this.validateProjectID(projectID);
this.validateAPISecret(apiSecret);

this.ProjectID = projectID;
this.APISecret = apiSecret;
this.Client = DefaultClient;
this.FrontendAPI = DefaultFrontendAPI.replace('[projectID]', projectID);
this.FrontendAPIWithCName = cname ?? this.FrontendAPI;
}

public setFrontendAPI(frontendApi: string): void {
Expand Down
2 changes: 1 addition & 1 deletion src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SDK {
this.session = new Session(
this.axiosClient,
config.ShortSessionCookieName,
config.FrontendAPI,
config.FrontendAPIWithCName,
`${config.FrontendAPI}/.well-known/jwks`,
config.CacheMaxAge
);
Expand Down

0 comments on commit 95592f5

Please sign in to comment.