-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.go
57 lines (49 loc) · 1.29 KB
/
options.go
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
package main
import (
"congest/network"
"fmt"
"os"
cmtconfig "github.com/tendermint/tendermint/config"
)
var (
Experiments = map[string]network.Experiment{
"large": {
Regions: FullRegions,
},
"2MB6s": {
Regions: FullRegions,
CfgOptions: []network.ConfigOption{
func(c *cmtconfig.Config) {
// note!: these aren't actually used yet, but this is what they should look like imo
// c.Consensus.TimeoutCommit = time.Millisecond * 2500
// c.Consensus.TimeoutPropose = time.Second * 5
},
},
},
"HalfNodes8MB": {
Regions: HalfRegions,
},
"minimal": {
Regions: MinimalRegions,
},
"test": {
Regions: TestRegions,
},
}
)
func getExperiment(test string) (network.Experiment, bool) {
experiment, ok := Experiments[test]
return experiment, ok
}
func readEnv() (experiment network.Experiment, chainID string, err error) {
chainID = os.Getenv("EXPERIMENT_CHAIN_ID")
rawExperiment := os.Getenv("EXPERIMENT_NAME")
if chainID == "" {
return experiment, "", fmt.Errorf("No chain ID provided, please provide a chain ID in the EXPERIMENT_CHAIN_ID environment variable")
}
experiment, has := getExperiment(rawExperiment)
if !has {
return experiment, "", fmt.Errorf("No experiment found with the name %s", rawExperiment)
}
return experiment, chainID, nil
}