...

Source file src/oss.terrastruct.com/d2/lib/env/env.go

Documentation: oss.terrastruct.com/d2/lib/env

     1  package env
     2  
     3  import (
     4  	"os"
     5  	"strconv"
     6  )
     7  
     8  func Test() bool {
     9  	return os.Getenv("TEST_MODE") != ""
    10  }
    11  
    12  func Dev() bool {
    13  	return os.Getenv("DEV_MODE") != ""
    14  }
    15  
    16  func Debug() bool {
    17  	return os.Getenv("DEBUG") != ""
    18  }
    19  
    20  // People have DEV_MODE on while running tests. If that's the case, this
    21  // function will return false.
    22  func DevOnly() bool {
    23  	return Dev() && !Test()
    24  }
    25  
    26  func SkipGraphDiffTests() bool {
    27  	return os.Getenv("SKIP_GRAPH_DIFF_TESTS") != ""
    28  }
    29  
    30  func Timeout() (int, bool) {
    31  	if s := os.Getenv("D2_TIMEOUT"); s != "" {
    32  		i, err := strconv.ParseInt(s, 10, 64)
    33  		if err == nil {
    34  			return int(i), true
    35  		}
    36  	}
    37  	return -1, false
    38  }
    39  

View as plain text