api

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package api contains the API server

Index

Constants

View Source
const (
	// General per-IP rate limit
	RPS   = 30
	Burst = 50

	// Body size limit
	MaxBodySize = 1 << 20
)

Variables

This section is empty.

Functions

func AgentWS added in v0.1.2

func AgentWS(state *state.State) http.HandlerFunc

func EventStream

func EventStream(ctx context.Context, state *state.State) http.HandlerFunc

func Login

func Login(token string) http.HandlerFunc

func Logout

func Logout() http.HandlerFunc

func PublishConfig

func PublishConfig(state *state.State) http.HandlerFunc

func PublishEnvs

func PublishEnvs(state *state.State) http.HandlerFunc

func WithBodyLimit

func WithBodyLimit(next http.Handler) http.Handler

WithBodyLimit restricts the size of incoming request bodies.

func WithRateLimit

func WithRateLimit(next http.Handler) http.Handler

WithRateLimit creates a simple IP-based rate limiter middleware.

func WithSecurityHeaders

func WithSecurityHeaders(next http.Handler) http.Handler

WithSecurityHeaders adds basic secure HTTP headers.

Types

type Chain

type Chain struct {
	// contains filtered or unexported fields
}

func NewChain

func NewChain(constructors ...Constructor) Chain

NewChain creates a new chain for a given list of middleware constructors

func (Chain) Then

func (c Chain) Then(h http.Handler) http.Handler

func (Chain) ThenFunc

func (c Chain) ThenFunc(fn http.HandlerFunc) http.Handler

type Constructor

type Constructor func(http.Handler) http.Handler

type LoginRequest

type LoginRequest struct {
	Secret string `json:"secret"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Config) *Server

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

func (*Server) WithAuth added in v0.1.2

func (s *Server) WithAuth(next http.Handler) http.Handler

func (*Server) WithLogger added in v0.1.2

func (s *Server) WithLogger(next http.Handler) http.Handler

type UpdateRequest added in v0.1.2

type UpdateRequest struct {
	Env    string          `json:"env"`
	Name   string          `json:"name"`
	Config json.RawMessage `json:"config"`
}

Jump to

Keyboard shortcuts

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