Documentation ¶
Index ¶
Examples ¶
Constants ¶
const ConfigEnvironmentVariable = "CONFIG"
ConfigEnvironmentVariable is the expected environment variable storing JSON configuration data.
const DefaultGraceful = 5
DefaultGraceful is the graceful shutdown timeout applied when no configuration value is given.
Variables ¶
This section is empty.
Functions ¶
func EnvironmentName ¶
EnvironmentName returns the name of the current execution environment from CONFIG. If no environment is detected, "local" is returned.
func FromEnvironment ¶
FromEnvironment unmarshals JSON configuration from the CONFIG environment variable into dst.
Example ¶
var config struct { CacheRedis Redis `json:"cache_redis"` } err := FromEnvironment(os.Getenv, &config) if err != nil { panic(err) }
Output:
Types ¶
type AWS ¶
type AWS struct { AccessKeyID string `json:"access_key_id" env:"AWS_ACCESS_KEY_ID"` AccessKeySecret string `json:"access_key_secret" env:"AWS_SECRET_ACCESS_KEY"` Region string `json:"region,omitempty" env:"AWS_REGION"` }
AWS configures credentials for access to Amazon Web Services. It is intended to be used in composition rather than a key.
func (AWS) Credentials ¶
func (a AWS) Credentials() *credentials.Credentials
Credentials returns a configured set of AWS credentials.
type JWT ¶
type JWT struct { Issuer string `json:"issuer"` Public string `json:"public"` Private string `json:"private,omitempty"` }
JWT configures public (and optionally private) keys and issuer for JSON Web Tokens. It is intended to be used in composition rather than a key.
type MongoDB ¶
type MongoDB struct { URI string `json:"uri"` ConnectTimeout time.Duration `json:"connect_timeout"` MaxConnIdleTime *time.Duration `json:"max_conn_idle_time"` MaxConnecting *uint64 `json:"max_connecting"` MaxPoolSize *uint64 `json:"max_pool_size"` MinPoolSize *uint64 `json:"min_pool_size"` }
MongoDB configures a connection to a Mongo database.
type Redis ¶
type Redis struct { URI string `json:"uri"` DialTimeout time.Duration `json:"dial_timeout"` ReadTimeout time.Duration `json:"read_timeout"` WriteTimeout time.Duration `json:"write_timeout"` }
Redis configures a connection to a Redis database.
type Server ¶
type Server struct { Addr string `json:"addr"` // Graceful enables graceful shutdown and is the time in seconds to wait // for all outstanding requests to terminate before forceably killing the // server. When no value is given, DefaultGraceful is used. Graceful // shutdown is disabled when less than zero. Graceful int `json:"graceful"` }
Server configures the binding and security of an HTTP server.
func (*Server) GracefulTimeout ¶
func (*Server) ListenAndServe ¶
ListenAndServe configures a HTTP server and begins listening for clients.
type UnderwriterOpts ¶
type UnderwriterOpts struct {
IncludeUnreleased bool `json:"include_unreleased"`
}
UnderwriterOpts represents the underwriters info/models options.