Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit f0d2741

Browse files
Allow storageDiff source to be set through an env variable
1 parent 267de00 commit f0d2741

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

cmd/composeAndExecute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func composeAndExecute() {
181181
}
182182

183183
if len(ethStorageInitializers) > 0 {
184-
switch stateDiffSource {
184+
switch storageDiffsSource {
185185
case "geth":
186186
log.Debug("fetching storage diffs from geth pub sub")
187187
rpcClient, _ := getClients()

cmd/execute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func execute() {
125125
}
126126

127127
if len(ethStorageInitializers) > 0 {
128-
switch stateDiffSource {
128+
switch storageDiffsSource {
129129
case "geth":
130130
log.Debug("fetching storage diffs from geth pub sub")
131131
rpcClient, _ := getClients()

cmd/root.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var (
4848
recheckHeadersArg bool
4949
SubCommand string
5050
LogWithCommand log.Entry
51-
stateDiffSource string
51+
storageDiffsSource string
5252
)
5353

5454
const (
@@ -81,6 +81,7 @@ func setViperConfigs() {
8181
ipc = viper.GetString("client.ipcpath")
8282
levelDbPath = viper.GetString("client.leveldbpath")
8383
storageDiffsPath = viper.GetString("filesystem.storageDiffsPath")
84+
storageDiffsSource = viper.GetString("storageDiffs.source")
8485
databaseConfig = config.Database{
8586
Name: viper.GetString("database.name"),
8687
Hostname: viper.GetString("database.hostname"),
@@ -119,9 +120,9 @@ func init() {
119120
rootCmd.PersistentFlags().String("client-ipcPath", "", "location of geth.ipc file")
120121
rootCmd.PersistentFlags().String("client-levelDbPath", "", "location of levelDb chaindata")
121122
rootCmd.PersistentFlags().String("filesystem-storageDiffsPath", "", "location of storage diffs csv file")
123+
rootCmd.PersistentFlags().String("storageDiffs-source", "csv", "where to get the state diffs: csv or geth")
122124
rootCmd.PersistentFlags().String("exporter-name", "exporter", "name of exporter plugin")
123125
rootCmd.PersistentFlags().String("log-level", log.InfoLevel.String(), "Log level (trace, debug, info, warn, error, fatal, panic")
124-
rootCmd.PersistentFlags().StringVar(&stateDiffSource, "state-diff-source", "csv", "where to get the state diffs: csv or geth")
125126

126127
viper.BindPFlag("database.name", rootCmd.PersistentFlags().Lookup("database-name"))
127128
viper.BindPFlag("database.port", rootCmd.PersistentFlags().Lookup("database-port"))
@@ -131,6 +132,7 @@ func init() {
131132
viper.BindPFlag("client.ipcPath", rootCmd.PersistentFlags().Lookup("client-ipcPath"))
132133
viper.BindPFlag("client.levelDbPath", rootCmd.PersistentFlags().Lookup("client-levelDbPath"))
133134
viper.BindPFlag("filesystem.storageDiffsPath", rootCmd.PersistentFlags().Lookup("filesystem-storageDiffsPath"))
135+
viper.BindPFlag("storageDiffs.source", rootCmd.PersistentFlags().Lookup("storageDiffs-source"))
134136
viper.BindPFlag("exporter.fileName", rootCmd.PersistentFlags().Lookup("exporter-name"))
135137
viper.BindPFlag("log.level", rootCmd.PersistentFlags().Lookup("log-level"))
136138
}

0 commit comments

Comments
 (0)