Documentation ¶
Index ¶
- Constants
- Variables
- func FxContext(ctx context.Context) fx.Option
- func FxOptions(c any) fx.Option
- func GetVariablesFromConfig(prefix string, cfg interface{}) ([]string, error)
- func LoadEnvironment(env Environment, files ...string)
- func Populate(ctx context.Context, prefix string, e env.Environment, module fx.Option, ...) error
- func RegisterConfigParser(typeName string, parser func(value reflect.Value, input string) error)
- func Run(prefix string, runner interface{}, cfg interface{})
- func URLParamFromContext(ctx context.Context, key string) string
- func URLParamFromRequest(r *http.Request, key string) string
- func Unmarshal(prefix string, cfg interface{}) error
- func UnmarshalFromEnv(prefix string, vars []string, cfg interface{}) error
- type BinaryMarshaler
- type ContextCredentials
- type Enabled
- type Environment
- type File
- type HasEnabled
- type HasFile
- type Runner
Constants ¶
const EnvironmentKey = "KETCH_ENVIRONMENT"
EnvironmentKey is the environment variable we look for to set the environment
Variables ¶
var AuthToken struct{}
AuthToken is the context key to retrieve the Authentication token from context
Functions ¶
func GetVariablesFromConfig ¶
GetVariablesFromConfig returns the environment variables from the given config object
func LoadEnvironment ¶
func LoadEnvironment(env Environment, files ...string)
LoadEnvironment loads the environment variables from the specified files and from the standard locations
func RegisterConfigParser ¶
RegisterConfigParser registers a config parser
func Run ¶
func Run(prefix string, runner interface{}, cfg interface{})
Run loads config and then executes the given runner
func URLParamFromContext ¶
URLParamFromContext returns the url parameter from a context.Context object.
func URLParamFromRequest ¶
URLParamFromRequest returns the url parameter from a http.Request object.
func UnmarshalFromEnv ¶
UnmarshalFromEnv reads configuration into the cfg object from the env vars
Types ¶
type BinaryMarshaler ¶
type BinaryMarshaler struct{}
BinaryMarshaler marshals the given object as a binary object
func (BinaryMarshaler) ContentType ¶
func (BinaryMarshaler) ContentType() string
ContentType returns the Content-Type which this marshaler is responsible for.
func (BinaryMarshaler) Marshal ¶
func (BinaryMarshaler) Marshal(v interface{}) ([]byte, error)
Marshal marshals "v" into byte sequence.
func (BinaryMarshaler) NewDecoder ¶
func (BinaryMarshaler) NewDecoder(r io.Reader) runtime.Decoder
NewDecoder returns a Decoder which reads byte sequence from "r".
func (BinaryMarshaler) NewEncoder ¶
func (BinaryMarshaler) NewEncoder(w io.Writer) runtime.Encoder
NewEncoder returns an Encoder which writes bytes sequence into "w".
func (BinaryMarshaler) Unmarshal ¶
func (BinaryMarshaler) Unmarshal(data []byte, v interface{}) error
Unmarshal unmarshals "data" into "v". "v" must be a pointer value.
type ContextCredentials ¶
type ContextCredentials struct{}
ContextCredentials provides credentials to the client based on the context
func (ContextCredentials) GetRequestMetadata ¶
func (j ContextCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)
GetRequestMetadata returns authorization metadata
func (ContextCredentials) RequireTransportSecurity ¶
func (j ContextCredentials) RequireTransportSecurity() bool
RequireTransportSecurity denotes we require transport security
type Environment ¶
type Environment string
Environment is a defined environment
func (Environment) IsLocal ¶
func (e Environment) IsLocal() bool
IsLocal returns true if the environment is not defined (aka local)
func (Environment) IsProduction ¶
func (e Environment) IsProduction() bool
IsProduction returns true if the environment is the production environment.
func (Environment) IsTest ¶
func (e Environment) IsTest() bool
IsTest returns true if the environment is the test environment
func (Environment) String ¶
func (e Environment) String() string
String returns a string version of the environment.
type HasEnabled ¶
type HasEnabled interface {
GetEnabled() bool
}
HasEnabled denotes an object provides an Enabled flag
type HasFile ¶
type HasFile interface {
GetFile() string
}
HasFile denotes an object provides a filename
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner represents a command runner
func (*Runner) SetupLogging ¶
func (r *Runner) SetupLogging(env Environment, loglevel string)
SetupLogging sets up logging for the environment and the default log level
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package errors provides utilities to augment errors Architecture of a good error: * system information - err Error() - displayed in logs * user message - displayed to end user * status code - returned to other systems * error code - standard error code usable within an application
|
Package errors provides utilities to augment errors Architecture of a good error: * system information - err Error() - displayed in logs * user message - displayed to end user * status code - returned to other systems * error code - standard error code usable within an application |
Code generated by winch.
|
Code generated by winch. |