app

package
v0.0.0-...-c298ccb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config appConfig

Functions

func LoadConfig

func LoadConfig(configPaths ...string) error

Deprecated read from env variables instead of files LoadConfig loads configuration from the given list of paths and populates it into the Config variable. The configuration file(s) should be named as app.yaml. Environment variables with the prefix "RESTFUL_" in their names are also read automatically.

func LoadMessages

func LoadMessages(file string) error

Deprecated read from env variables instead of files

Types

type APIError

type APIError struct {
	// Status represents the HTTP status code
	Status int `json:"-"`
	// ErrorCode is the code uniquely identifying an error
	ErrorCode string `json:"error_code"`
	// Message is the error message that may be displayed to end users
	Message string `json:"message"`
	// DeveloperMessage is the error message that is mainly meant for developers
	DeveloperMessage string `json:"developer_message,omitempty"`
	// Details specifies the additional error information
	Details interface{} `json:"details,omitempty"`
}

Deprecated read from env variables instead of files

func NewAPIError

func NewAPIError(status int, code string, params Params) *APIError

NewAPIError creates a new APIError with the given HTTP status code, error code, and parameters for replacing placeholders in the error template. The param can be nil, indicating there is no need for placeholder replacement.

type Params

type Params map[string]interface{}

Params is used to replace placeholders in an error template with the corresponding values.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL