github.com/kubeshop/testkube@v1.17.23/cmd/tcl/testworkflow-init/data/config.go (about)

     1  // Copyright 2024 Testkube.
     2  //
     3  // Licensed as a Testkube Pro file under the Testkube Community
     4  // License (the "License"); you may not use this file except in compliance with
     5  // the License. You may obtain a copy of the License at
     6  //
     7  //	https://github.com/kubeshop/testkube/blob/main/licenses/TCL.txt
     8  
     9  package data
    10  
    11  import (
    12  	"os"
    13  )
    14  
    15  type config struct {
    16  	Negative   bool
    17  	Debug      bool
    18  	RetryCount int
    19  	RetryUntil string
    20  
    21  	Resulting []Rule
    22  }
    23  
    24  var Config = &config{
    25  	Debug: os.Getenv("DEBUG") == "1",
    26  }
    27  
    28  func LoadConfig(config map[string]string) {
    29  	Config.Debug = getBool(config, "debug", Config.Debug)
    30  	Config.RetryCount = getInt(config, "retryCount", 0)
    31  	Config.RetryUntil = getStr(config, "retryUntil", "self.passed")
    32  	Config.Negative = getBool(config, "negative", false)
    33  }