INNER CODE UNIT · Go
validateConfig
lamoda/gonkey · main.go:150
func validateConfig(cfg *config) {
if cfg.Host == "" {
log.Fatal(errors.New("service hostname not provided"))
}
if !strings.HasPrefix(cfg.Host, "http://") && !strings.HasPrefix(cfg.Host, "https://") {
cfg.Host = "http://" + cfg.Host
}
cfg.Host = strings.TrimRight(cfg.Host, "/")
if cfg.TestsLocation == "" {
log.Fatal(errors.New("no tests location provided"))
}
if cfg.EnvFile != "" {
if err := godotenv.Load(cfg.EnvFile); err != nil {
log.Println(errors.New("can't load .env file"), err)
}
}