Skip to content

Commit

Permalink
Merge pull request #317 from irisZhangCB/pass-in-node-url
Browse files Browse the repository at this point in the history
Add command flag for result file
  • Loading branch information
irisZhangCB authored May 20, 2022
2 parents 88cd3ca + c725fea commit 4185c9d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"

WORKDIR /go/src

ARG VERSION=v0.7.7
ARG VERSION=v0.7.9
RUN git clone https://github.com/coinbase/rosetta-cli.git && \
cd rosetta-cli && \
git fetch --all --tags && \
Expand Down
41 changes: 32 additions & 9 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ var (
PersistentPreRunE: rootPreRun,
}

configurationFile string
cpuProfile string
memProfile string
blockProfile string
onlineURL string
offlineURL string
startIndex int64
endIndex int64
configurationFile string
cpuProfile string
memProfile string
blockProfile string
onlineURL string
offlineURL string
startIndex int64
endIndex int64
dataResultFile string
constructionResultFile string

// Config is the populated *configuration.Configuration from
// the configurationFile. If none is provided, this is set
Expand Down Expand Up @@ -243,6 +245,13 @@ default values.`,
`End-block configures the syncer to stop once reaching a particular block height. This will override the index from configuration file`,
)

checkDataCmd.Flags().StringVar(
&dataResultFile,
"result-file",
"",
"Result-file configures the location of validation result. This will override the results_output_file from configuration file",
)

rootCmd.AddCommand(checkDataCmd)
checkConstructionCmd.Flags().StringVar(
&asserterConfigurationFile,
Expand All @@ -265,6 +274,12 @@ default values.`,
"Override offline node url in configuration file",
)

checkConstructionCmd.Flags().StringVar(
&constructionResultFile,
"result-file",
"",
"Result-file configures the location of validation result. This will override the results_output_file from configuration file",
)
rootCmd.AddCommand(checkConstructionCmd)

// View Commands
Expand Down Expand Up @@ -325,6 +340,14 @@ func initConfig() {
if endIndex != -1 {
Config.Data.EndConditions.Index = &endIndex
}

if len(dataResultFile) != 0 {
Config.Data.ResultsOutputFile = dataResultFile
}

if len(constructionResultFile) != 0 {
Config.Construction.ResultsOutputFile = constructionResultFile
}
}

func ensureDataDirectoryExists() {
Expand Down Expand Up @@ -360,6 +383,6 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "Print rosetta-cli version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("v0.7.7")
fmt.Println("v0.7.9")
},
}

0 comments on commit 4185c9d

Please sign in to comment.