Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add datadir to Command param #320

Merged
merged 3 commits into from
May 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var (
endIndex int64
dataResultFile string
constructionResultFile string
dataDirectory string

// Config is the populated *configuration.Configuration from
// the configurationFile. If none is provided, this is set
Expand Down Expand Up @@ -252,6 +253,12 @@ default values.`,
"Result-file configures the location of validation result. This will override the results_output_file from configuration file",
)

checkDataCmd.Flags().StringVar(
&dataDirectory,
"data-dir",
"",
"Data-dir configures the location of logs and data for validation. This will override the data_directory from configuration file",
)
rootCmd.AddCommand(checkDataCmd)
checkConstructionCmd.Flags().StringVar(
&asserterConfigurationFile,
Expand Down Expand Up @@ -348,6 +355,10 @@ func initConfig() {
if len(constructionResultFile) != 0 {
Config.Construction.ResultsOutputFile = constructionResultFile
}

if len(dataDirectory) != 0 {
Config.DataDirectory = dataDirectory
}
}

func ensureDataDirectoryExists() {
Expand Down