api

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const RequestHeader = "Gitlab-Workhorse-Api-Request"
View Source
const ResponseContentType = "application/vnd.gitlab-workhorse+json"

Custom content type for API responses, to catch routing / programming mistakes

Variables

This section is empty.

Functions

func Block added in v0.8.0

func Block(h http.Handler) http.Handler

Prevent internal API responses intended for gitlab-workhorse from leaking to the end user

Types

type API

type API struct {
	Client  *http.Client
	URL     *url.URL
	Version string
	Secret  *Secret
}

func NewAPI

func NewAPI(myURL *url.URL, version, secretPath string, roundTripper *badgateway.RoundTripper) *API

func (*API) PreAuthorizeHandler

func (api *API) PreAuthorizeHandler(h HandleFunc, suffix string) http.Handler

type HandleFunc

type HandleFunc func(http.ResponseWriter, *http.Request, *Response)

type Response

type Response struct {
	// GL_ID is an environment variable used by gitlab-shell hooks during 'git
	// push' and 'git pull'
	GL_ID string
	// RepoPath is the full path on disk to the Git repository the request is
	// about
	RepoPath string
	// StoreLFSPath is provided by the GitLab Rails application
	// to mark where the tmp file should be placed
	StoreLFSPath string
	// LFS object id
	LfsOid string
	// LFS object size
	LfsSize int64
	// TmpPath is the path where we should store temporary files
	// This is set by authorization middleware
	TempPath string
	// Archive is the path where the artifacts archive is stored
	Archive string `json:"archive"`
	// Entry is a filename inside the archive point to file that needs to be extracted
	Entry string `json:"entry"`
}

type Secret added in v0.8.0

type Secret struct {
	Path string

	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Secret) Bytes added in v0.8.0

func (s *Secret) Bytes() ([]byte, error)

Lazy access to the HMAC secret key. We must be lazy because if the key is not already there, it will be generated by gitlab-rails, and gitlab-rails is slow.

Jump to

Keyboard shortcuts

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