-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsnap.config.ts
More file actions
79 lines (67 loc) · 1.73 KB
/
Copy pathsnap.config.ts
File metadata and controls
79 lines (67 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* eslint-disable n/no-process-env */
import { type SnapConfig } from '@metamask/snaps-cli';
import * as dotenv from 'dotenv';
import { resolve } from 'path';
dotenv.config();
const {
SNAP_ENV,
PRICE_API_BASE_URL,
STORE_PERMISSIONS_ENABLED,
USE_EOA_ACCOUNT,
ACCOUNT_API_BASE_URL,
SUPPORTED_CHAINS,
} = process.env;
if (!SNAP_ENV) {
throw new Error('SNAP_ENV must be set as an environment variable.');
}
if (!PRICE_API_BASE_URL) {
throw new Error('PRICE_API_BASE_URL must be set as an environment variable.');
}
if (!STORE_PERMISSIONS_ENABLED) {
throw new Error(
'STORE_PERMISSIONS_ENABLED must be set as an environment variable.',
);
}
if (
STORE_PERMISSIONS_ENABLED !== 'true' &&
STORE_PERMISSIONS_ENABLED !== 'false'
) {
throw new Error(
'STORE_PERMISSIONS_ENABLED must be set as an environment variable and must be set to "true" or "false".',
);
}
if (!USE_EOA_ACCOUNT) {
throw new Error('USE_EOA_ACCOUNT must be set as an environment variable.');
}
if (USE_EOA_ACCOUNT !== 'true' && USE_EOA_ACCOUNT !== 'false') {
throw new Error(
'USE_EOA_ACCOUNT must be set as an environment variable and must be set to "true" or "false".',
);
}
if (!ACCOUNT_API_BASE_URL) {
throw new Error(
'ACCOUNT_API_BASE_URL must be set as an environment variable.',
);
}
if (!SUPPORTED_CHAINS) {
throw new Error('SUPPORTED_CHAINS must be set as an environment variable.');
}
const config: SnapConfig = {
input: resolve(__dirname, 'src/index.ts'),
server: {
port: 8082,
},
polyfills: {
buffer: true,
crypto: true,
},
environment: {
SNAP_ENV,
PRICE_API_BASE_URL,
STORE_PERMISSIONS_ENABLED,
USE_EOA_ACCOUNT,
ACCOUNT_API_BASE_URL,
SUPPORTED_CHAINS,
},
};
export default config;