-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodules.ts
More file actions
33 lines (29 loc) · 1.36 KB
/
modules.ts
File metadata and controls
33 lines (29 loc) · 1.36 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
import {nonNullish, notEmptyString} from '@dfinity/utils';
import type {Module} from '../services/modules/module.services';
import {cmc} from './cmc';
import {consoleModule} from './console';
import {governance} from './governance';
import {icpIndex} from './icp-index';
import {icpLedger} from './icp-ledger';
import {internetIdentity} from './internet-identity';
import {observatory} from './observatory';
import {satellite} from './satellite';
const MODULES = [internetIdentity, icpLedger, icpIndex, satellite, consoleModule, observatory];
// Canisters that require other modules (like the ledger) to be installed first
// before they can be initialized. Still a mystery how they were deployed at genesis...
//
// Also, the order matters. For example:
// - The CMC must be available when the Governance canister is installed.
// - The Governance must be available when the CMC post-install runs.
// - The CMC post-install must runs before the Governance one.
//
// Yolo
const TROUBLEMAKERS = [cmc, governance];
const filterModules = (modules: Module[]): Module[] =>
(process.env.MODULES ?? '')
.split(',')
.filter((moduleKey) => notEmptyString(moduleKey))
.map((moduleKey) => modules.find(({key}) => key === moduleKey.trim()))
.filter((mod) => nonNullish(mod));
export const modules = filterModules(MODULES);
export const troublemakers = filterModules(TROUBLEMAKERS);