server

package
v0.0.0-...-e75a48e Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package server contains all the server related functions of the ConfigServer app

Index

Constants

View Source
const (
	ClientSecretSeparatorChar = "|" // ClientSecretSeparatorChar is the Char used to separate client secret component
	ClientSecretComponents    = 2   // ClientSecretComponents is the number of components used in client secrets
)
View Source
const HTTPRequestDuration = "http.request.duration"

HTTPRequestDuration represents the logging key for the http request Duration

View Source
const HTTPRequestID = "http.request.id"

HTTPRequestID represents the logging key for the http request Id

View Source
const HTTPRequestMethod = "http.request.method"

HTTPRequestMethod represents the logging key for the http request Method

View Source
const HTTPRequestPath = "http.request.path"

HTTPRequestPath represents the logging key for the http request Path

View Source
const HTTPRequestStatus = "http.request.status"

HTTPRequestStatus represents the logging key for the http request Status

Variables

This section is empty.

Functions

func HTTPInternalServerError

func HTTPInternalServerError(w http.ResponseWriter, r *http.Request, detail string, params ...interface{})

HTTPInternalServerError returns an HTTP 500 error along a RFC9457 compliant error detail

func HTTPNotFound

func HTTPNotFound(w http.ResponseWriter, r *http.Request, detail string, params ...interface{})

HTTPNotFound returns an HTTP 404 error along a RFC9457 compliant error detail

func HTTPUnauthorized

func HTTPUnauthorized(w http.ResponseWriter, r *http.Request, detail string, params ...interface{})

HTTPUnauthorized returns an HTTP 401 error along a RFC9457 compliant error detail

func HTTPUnsupportedMediaType

func HTTPUnsupportedMediaType(w http.ResponseWriter, r *http.Request, detail string, params ...interface{})

HTTPUnsupportedMediaType returns an HTTP 415 error along a RFC9457 compliant error detail

func Ok

func Ok(w http.ResponseWriter, content []byte, mimetype string)

Ok returns an HTTP 201 response along the provided content

Types

type ConfigServer

type ConfigServer struct {
	Configuration *configuration.Configuration
}

ConfigServer is a standalone server which aims to securely serve git repositories via http

func NewConfigServer

func NewConfigServer(c *configuration.Configuration) *ConfigServer

NewConfigServer initializes a new ConfigServer instance

func (*ConfigServer) Start

func (c *ConfigServer) Start()

Start is where all the magic happens

type ProblemDetail

type ProblemDetail struct {
	ProblemType string `json:"type"`
	Title       string `json:"title"`
	Detail      string `json:"detail"`
	Instance    string `json:"instance"`
	Status      int    `json:"status"`
}

ProblemDetail is a RFC9457 compliant error detail used by the server to return errors.

type RegisterClientResponse

type RegisterClientResponse struct {
	ClientID     string    `json:"client_id"`
	ClientSecret string    `json:"client_secret"`
	ExpiresAt    time.Time `json:"expires_at"`
}

RegisterClientResponse represents the API's output

Jump to

Keyboard shortcuts

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