gitrest

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: BSD-2-Clause Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gitrest is the write half of the API. It hands a fully rendered file to the vault's git-rest service, which commits and pushes it as the vault's own git identity. The API never touches git itself and the vault volume stays mounted read-only.

Index

Constants

View Source
const HeaderGatewayInitator = "X-Gateway-Initator"

HeaderGatewayInitator is the caller-identity header git-rest's auth middleware requires to be non-empty — it answers 500 when the header is missing, before it ever checks the secret. The misspelling (missing the second "i") is deliberate and part of git-rest's frozen public contract, so it is reproduced verbatim.

View Source
const HeaderGatewaySecret = "X-Gateway-Secret"

HeaderGatewaySecret is the header git-rest reads the shared secret from.

View Source
const Initiator = "vault-api"

Initiator is the value this client sends in HeaderGatewayInitator. git-rest only checks that the header is non-empty; the value is what its request log records as the caller.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// WriteFile replaces path with content. git-rest answers {"ok":true} and no
	// SHA, so the resulting commit is identified afterwards from git log, never
	// from this call's response.
	WriteFile(ctx context.Context, path string, content []byte) error
}

Client writes one complete file through git-rest.

func NewClient

func NewClient(baseURL string, gatewaySecret string, httpClient *http.Client) Client

NewClient returns a Client that posts to baseURL. gatewaySecret is sent as X-Gateway-Secret; an empty secret sends no header, matching a git-rest instance started without one.

type StatusError

type StatusError struct {
	StatusCode int
	Body       string
}

StatusError is a non-2xx answer from git-rest. The handler maps it to the status the caller should see, so a refusal upstream is not reported as a failure of this API.

func (*StatusError) Error

func (e *StatusError) Error() string

Error returns the git-rest status and the body it answered with.

Jump to

Keyboard shortcuts

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