Skip to content

Commit

Permalink
feat: Resolve Debug to redirect to UI tool on web
Browse files Browse the repository at this point in the history
  • Loading branch information
nickybondarenko committed Nov 26, 2024
1 parent 053d77f commit 91fe0bf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/sdk/src/Confidence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export interface Configuration {
/** Flag Resolver Client
* @internal */
readonly flagResolverClient: FlagResolverClient;
/* @internal */
readonly clientSecret: string;
}

/**
Expand Down Expand Up @@ -311,7 +313,13 @@ export class Confidence implements EventSender, Trackable, FlagResolver {
getFlag(path: string, defaultValue: number): Promise<number>;
getFlag<T extends Value>(path: string, defaultValue: T): Promise<T>;
async getFlag<T extends Value>(path: string, defaultValue: any): Promise<T> {
return (await this.evaluateFlag(path, defaultValue)).value;
const clientKey = this.config.clientSecret;
const flag = (await this.evaluateFlag(path, defaultValue)).value;
const context = this._context;
this.config.logger.debug?.(
`Resolve debug: https://app.confidence.spotify.com/flags/resolver-test?client-key=${clientKey}&flag=flags/${flag}&context=${context}`,
);
return flag;
}

/**
Expand Down Expand Up @@ -374,6 +382,7 @@ export class Confidence implements EventSender, Trackable, FlagResolver {
eventSenderEngine,
timeout,
logger,
clientSecret,
});
}
}
Expand Down

0 comments on commit 91fe0bf

Please sign in to comment.