@@ -11,6 +11,7 @@ import axios from 'axios';
1111import { GGShieldConfiguration } from "./ggshield-configuration" ;
1212import { GGShieldScanResults } from "./api-types" ;
1313import * as os from "os" ;
14+ import { apiToDashboard , dasboardToApi } from "../utils" ;
1415
1516/**
1617 * Run ggshield CLI application with specified arguments
@@ -97,9 +98,10 @@ export async function getAPIquota(
9798export async function getRemediationMessage (
9899 configuration : GGShieldConfiguration
99100) : Promise < string > {
101+ const apiUrl = dasboardToApi ( configuration . apiUrl ) ;
100102 const path = require ( 'node:path' ) ;
101103 try {
102- const response = await axios . get ( path . join ( configuration . apiUrl , 'v1/metadata' ) , {
104+ const response = await axios . get ( path . join ( apiUrl , 'v1/metadata' ) , {
103105 headers : {
104106 'authorization' : `Token ${ configuration . apiKey } `
105107 }
@@ -305,7 +307,7 @@ export function ggshieldApiKey(
305307 const apiUrl = configuration . apiUrl ;
306308 const re = / a p i / ;
307309
308- const regexInstanceSection = `\\[${ apiUrl . replace ( re , "dashboard" ) } \\]([\\s\\S]*?)(?=\\[|$)` ;
310+ const regexInstanceSection = `\\[${ apiToDashboard ( apiUrl ) } \\]([\\s\\S]*?)(?=\\[|$)` ;
309311 const instanceSectionMatch = proc . stdout . match ( regexInstanceSection ) ;
310312
311313 if ( instanceSectionMatch ) {
0 commit comments