@@ -11,6 +11,7 @@ import axios from 'axios';
11
11
import { GGShieldConfiguration } from "./ggshield-configuration" ;
12
12
import { GGShieldScanResults } from "./api-types" ;
13
13
import * as os from "os" ;
14
+ import { apiToDashboard , dasboardToApi } from "../utils" ;
14
15
15
16
/**
16
17
* Run ggshield CLI application with specified arguments
@@ -97,9 +98,10 @@ export async function getAPIquota(
97
98
export async function getRemediationMessage (
98
99
configuration : GGShieldConfiguration
99
100
) : Promise < string > {
101
+ const apiUrl = dasboardToApi ( configuration . apiUrl ) ;
100
102
const path = require ( 'node:path' ) ;
101
103
try {
102
- const response = await axios . get ( path . join ( configuration . apiUrl , 'v1/metadata' ) , {
104
+ const response = await axios . get ( path . join ( apiUrl , 'v1/metadata' ) , {
103
105
headers : {
104
106
'authorization' : `Token ${ configuration . apiKey } `
105
107
}
@@ -305,7 +307,7 @@ export function ggshieldApiKey(
305
307
const apiUrl = configuration . apiUrl ;
306
308
const re = / a p i / ;
307
309
308
- const regexInstanceSection = `\\[${ apiUrl . replace ( re , "dashboard" ) } \\]([\\s\\S]*?)(?=\\[|$)` ;
310
+ const regexInstanceSection = `\\[${ apiToDashboard ( apiUrl ) } \\]([\\s\\S]*?)(?=\\[|$)` ;
309
311
const instanceSectionMatch = proc . stdout . match ( regexInstanceSection ) ;
310
312
311
313
if ( instanceSectionMatch ) {
0 commit comments