github.com/thlcodes/genfig@v0.3.2-alpha/example/config/envs.go (about)

     1  // Code generated by genfig; DO NOT EDIT.
     2  
     3  package config
     4  
     5  // Envs holds the environment-specific configurations so that
     6  // they can easily be accessed by e.g. Envs.Default
     7  var Envs = struct {
     8  	Default          Config
     9  	Development      Config
    10  	DevelopmentLocal Config
    11  	Local            Config
    12  	Production       Config
    13  	Test             Config
    14  }{}
    15  
    16  var envMap = map[string]*Config{
    17  	"default":           &Envs.Default,
    18  	"development":       &Envs.Development,
    19  	"development.local": &Envs.DevelopmentLocal,
    20  	"local":             &Envs.Local,
    21  	"production":        &Envs.Production,
    22  	"test":              &Envs.Test,
    23  }
    24  
    25  // Get returns the config matching 'env' if found, otherwie the default config.
    26  // The bool return value indicates, if a match was found (true) or the default config
    27  // is returned
    28  func Get(env string) (*Config, bool) {
    29  	if c, ok := envMap[env]; ok {
    30  		return c, true
    31  	}
    32  	return &Envs.Default, false
    33  }