Skip to content

Commit 9e080b0

Browse files
committed
use fetch in index
1 parent 952afc9 commit 9e080b0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
/**
22
* Entry point for the application.
33
* */
4-
import axios from 'axios';
54
import cp from 'child_process';
65
import fs from 'fs';
76

87
async function start() {
98
if (process.env.PROVIDER === 'gce' && !fs.existsSync('/usr/src/.env')) {
10-
const resp = await axios.get(
9+
const resp = await fetch(
1110
'http://metadata.google.internal/computeMetadata/v1/project/attributes/env',
1211
{
1312
headers: {
1413
'Metadata-Flavor': 'Google',
1514
},
16-
responseType: 'arraybuffer',
1715
},
1816
);
19-
fs.writeFileSync('/usr/src/.env', resp.data);
17+
fs.writeFileSync('/usr/src/.env', await resp.text());
2018
}
2119
if (process.env.ROLE) {
2220
// if role variable is set just run that script

0 commit comments

Comments
 (0)