Skip to content

Commit

Permalink
the linter wants to be very careful about regexp logic maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
gvelez17 committed Apr 22, 2024
1 parent 15d1c06 commit 6d4482e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ export class CeramicAnchorApp {

// in this case, return only the task id following the last /
const match = this.config.metrics.instanceIdentifier.match(/\/([^\/]*)$/);
const instanceId: string = match ? match[1] : this.config.metrics.instanceIdentifier
Metrics.setInstanceIdentifier(instanceId)
if (match and match[1]) {
Metrics.setInstanceIdentifier(match[1])
} else {
Metrics.setInstanceIdentifier(this.config.metrics.instanceIdentifier)
}
}
} catch (e: any) {
logger.imp('ERROR: Metrics exporter failed to start. Continuing anyway.')
Expand Down

0 comments on commit 6d4482e

Please sign in to comment.