-
Notifications
You must be signed in to change notification settings - Fork 1
/
dfx.webpack.config.js
60 lines (54 loc) · 1.6 KB
/
dfx.webpack.config.js
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
const path = require("path")
let localCanisters, prodCanisters, canisters
function initCanisterIds() {
try {
localCanisters = require(".dfx/local/canister_ids.json")
} catch (error) {
console.log("No local canister_ids.json found. Continuing production")
}
try {
prodCanisters = require(path.resolve("canister_ids.json"))
} catch (error) {
console.log("No production canister_ids.json found. Continuing with local")
}
localCanisters = {
"__Candid_UI": {
"local": "ryjl3-tyaaa-aaaaa-aaaba-cai"
},
"frontend": {
"local": "qoctq-giaaa-aaaaa-aaaea-cai"
},
"internet_identity": {
"local": "renrk-eyaaa-aaaaa-aaada-cai"
},
"ledger": {
"local": "rrkah-fqaaa-aaaaa-aaaaq-cai"
},
"meta_yield": {
"local": "rdmx6-jaaaa-aaaaa-aaadq-cai"
},
"pToken": {
"local": "rkp4c-7iaaa-aaaaa-aaaca-cai"
},
"stICP": {
"local": "r7inp-6aaaa-aaaaa-aaabq-cai"
},
"web": {
"local": "rno2w-sqaaa-aaaaa-aaacq-cai"
}
};
const network =
process.env.DFX_NETWORK ||
(process.env.NODE_ENV === "production" ? "ic" : "local")
console.info(`initCanisterIds: network=${network}`)
console.info(`initCanisterIds: DFX_NETWORK=${process.env.DFX_NETWORK}`)
console.info(`initCanisterIds: NEXT_PUBLIC_IC_HOST=${process.env.NEXT_PUBLIC_IC_HOST}`)
canisters = network === "local" ? localCanisters : prodCanisters
for (const canister in canisters) {
process.env[`NEXT_PUBLIC_${canister.toUpperCase()}_CANISTER_ID`] =
canisters[canister][network];
}
}
module.exports = {
initCanisterIds: initCanisterIds
}