Skip to content

Commit af9dec1

Browse files
ci: update utils to use simplified environment variables
1 parent 393dd3a commit af9dec1

File tree

1 file changed

+16
-38
lines changed

1 file changed

+16
-38
lines changed

deployment-dapp/src/utils/utils.ts

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,22 @@
11
import fs from 'fs/promises';
22
import { IExec, utils } from 'iexec';
3-
import { HOST } from '../config/config.js';
43

5-
export const getIExec = (privateKey: string): IExec => {
6-
const ethProvider = utils.getSignerFromPrivateKey(HOST, privateKey);
7-
return new IExec({
8-
ethProvider,
4+
export const getIExec = (
5+
privateKey: string,
6+
host: string = 'bellecour'
7+
): IExec => {
8+
const ethProvider = utils.getSignerFromPrivateKey(host, privateKey, {
9+
providers: {},
10+
allowExperimentalNetworks: true,
911
});
10-
};
11-
12-
export const getDockerImageChecksum = async (
13-
namespace: string,
14-
repository: string,
15-
tag: string
16-
): Promise<string> => {
17-
try {
18-
const manifest = await fetch(
19-
`https://hub.docker.com/v2/namespaces/${namespace}/repositories/${repository}/tags/${tag}`
20-
).then((res) => res.json());
21-
const digest = manifest.digest as string;
22-
if (digest) {
23-
return digest.replace('sha256:', '0x');
12+
return new IExec(
13+
{
14+
ethProvider,
15+
},
16+
{
17+
allowExperimentalNetworks: true,
2418
}
25-
} catch (err) {
26-
throw Error(
27-
`Error inspecting image ${namespace}/${repository}:${tag}: ${err}`
28-
);
29-
}
30-
};
31-
32-
/**
33-
* read the scone fingerprint from previously generated `.scone-fingerprint`
34-
*/
35-
export const loadSconeFingerprint = async (): Promise<string> => {
36-
try {
37-
const fingerprint = await fs.readFile('.scone-fingerprint', 'utf8');
38-
return fingerprint.trim();
39-
} catch (err) {
40-
throw Error(`Error reading .scone-fingerprint: ${err}`);
41-
}
19+
);
4220
};
4321

4422
const APP_ADDRESS_FILE = '.app-address';
@@ -52,8 +30,8 @@ export const saveAppAddress = async (address: string) =>
5230
*/
5331
export const loadAppAddress = async () => {
5432
try {
55-
const appAddress = await fs.readFile(APP_ADDRESS_FILE, 'utf8');
56-
return appAddress.trim();
33+
const fingerprint = await fs.readFile(APP_ADDRESS_FILE, 'utf8');
34+
return fingerprint.trim();
5735
} catch (err) {
5836
throw Error(`Error reading .app-address: ${err}`);
5937
}

0 commit comments

Comments
 (0)