Skip to content

Commit

Permalink
Fixed remote config
Browse files Browse the repository at this point in the history
  • Loading branch information
aklarfeld committed Dec 18, 2023
1 parent 2530cb2 commit d484bca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ const Supergood = () => {
config?: Partial<ConfigType>;
metadata?: Partial<MetadataType>;
} = {
clientId: process.env.SUPERGOOD_CLIENT_ID as string,
clientSecret: process.env.SUPERGOOD_CLIENT_SECRET as string,
config: {} as Partial<ConfigType>,
metadata: {} as Partial<MetadataType>
},
clientId: process.env.SUPERGOOD_CLIENT_ID as string,
clientSecret: process.env.SUPERGOOD_CLIENT_SECRET as string,
config: {} as Partial<ConfigType>,
metadata: {} as Partial<MetadataType>
},
baseUrl = process.env.SUPERGOOD_BASE_URL || 'https://api.supergood.ai'
) => {
if (!clientId) throw new Error(errors.NO_CLIENT_ID);
Expand Down Expand Up @@ -130,7 +130,7 @@ const Supergood = () => {
async (request: IsomorphicRequest, requestId: string) => {
// Don't intercept if there's no remote config set
// to avoid sensitive keys being sent to the SG server.
if(!supergoodConfig.remoteConfig) return;
if (!supergoodConfig.remoteConfig) return;

try {
const url = new URL(request.url);
Expand Down Expand Up @@ -181,7 +181,7 @@ const Supergood = () => {
let requestData = { url: '' };
let responseData = {};

if(!supergoodConfig.remoteConfig) return;
if (!supergoodConfig.remoteConfig) return;

try {
const requestData = requestCache.get(requestId) as {
Expand Down Expand Up @@ -289,7 +289,6 @@ const Supergood = () => {
}
if (data.length) {
log.debug(`Flushed ${data.length} events`, { force });
log.debug(`Flushing Ids: ${data.map((event) => event.request.id)}`)
}
} catch (e) {
const error = e as Error;
Expand Down
1 change: 1 addition & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ const redactValuesFromKeys = (
const value = _get(event, keyPath);
if (value) {
_set(event, keyPath, null);
// Don't return <string-length>:<string-type> for null values
sensitiveKeyMetadata.push({ keyPath: unmarshalKeyPath(keyPath), ...redactValue(value) });
}
}
Expand Down

0 comments on commit d484bca

Please sign in to comment.