You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
console.log(`could not create mask for secret: ${secret.key}, because server responded with: ${res.statusCode}\n\n${res.body}`);
19
-
process.exit(1);
20
-
}
21
-
console.log(`successfully updated masks with secret: ${secret.key}`);
22
-
process.exit(0);
23
-
})
24
-
.catch((err)=>{
25
-
console.log(`could not create mask for secret: ${secret.key}, due to error: ${err}`);
26
-
process.exit(1);
3
+
asyncfunctionupdateMasks(secret){
4
+
try{
5
+
constserverAddress=awaitsecretsServerAddress;
6
+
7
+
const{default: got}=awaitimport('got');
8
+
/** @type {import('got').Got} */
9
+
consthttpClient=got.extend({
10
+
prefixUrl: serverAddress,
11
+
responseType: 'json',
12
+
throwHttpErrors: false,
27
13
});
14
+
constresponse=awaithttpClient.post(
15
+
'secrets',
16
+
{json: secret},
17
+
);
18
+
19
+
if(!response.ok){
20
+
console.error(`could not create mask for secret: ${secret.key}, because server responded with: ${response.statusCode}\n\n${JSON.stringify(response.body)}`);
21
+
process.exit(1);
22
+
}
23
+
console.log(`successfully updated masks with secret: ${secret.key}`);
24
+
process.exit(0);
25
+
}catch(error){
26
+
console.log(`could not create mask for secret: ${secret.key}, due to error: ${error}`);
0 commit comments