fixed version check, removed duplicate kube config, fix flags warning, fixed log of invalid config (#227)

This commit is contained in:
RoyUP9
2021-08-18 18:10:47 +03:00
committed by GitHub
parent 2ae0a2400d
commit bf27e94003
12 changed files with 102 additions and 33 deletions

View File

@@ -0,0 +1,35 @@
package configStructs
import (
"fmt"
"os"
"path"
)
const (
FileLogsName = "file"
)
type LogsConfig struct {
FileStr string `yaml:"file"`
}
func (config *LogsConfig) Validate() error {
if config.FileStr == "" {
_, err := os.Getwd()
if err != nil {
return fmt.Errorf("failed to get PWD, %v (try using `mizu logs -f <full path dest zip file>)`", err)
}
}
return nil
}
func (config *LogsConfig) FilePath() string {
if config.FileStr == "" {
pwd, _ := os.Getwd()
return path.Join(pwd, "mizu_logs.zip")
}
return config.FileStr
}