web

package
v0.0.0-...-70978f0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const CouchDBProxyHiddenPathStatus = http.StatusTeapot

CouchDBProxyHiddenPathStatus is the http status that gets delivered to users in case the underlying endpoint should not be reachable via reverse proxy

View Source
const PathCORSProxy = "/service/cors-proxy"

PathCORSProxy is the prefix for CORS proxy requests

View Source
const PathCouchDbService = "/service/couchdb"

PathCouchDbService is the prefix for couchdb proxy requests

View Source
const StatusInvalidContentType = "ORIGIN_RESPONSE_CONTENT_TYPE_UNSUPPORTED"

StatusInvalidContentType indicates that the response content type is not supported by funnel

View Source
const StatusInvalidURL = "INVALID_URL"

StatusInvalidURL indicates that the requested url is not valid and can not be requested

View Source
const StatusReadFailed = "ORIGIN_RESPONSE_READ_FAILED"

StatusReadFailed indicates during reading from the origin a problem occurred

View Source
const StatusRequestFailed = "ORIGIN_REQUEST_FAILED"

StatusRequestFailed indicates the request to the origin has failed

Variables

This section is empty.

Functions

func CORSProxyHandler

func CORSProxyHandler(w http.ResponseWriter, r *http.Request)

CORSProxyHandler contains functionality to route GET request to other origins

func CouchDbProxyHandler

func CouchDbProxyHandler(w http.ResponseWriter, r *http.Request)

CouchDbProxyHandler is the proxy for couchdb

func CreateCouchDBReverseProxy

func CreateCouchDBReverseProxy(cfg *config.AppConfig)

CreateCouchDBReverseProxy must be called after configuration has been loaded and before executing requests against the couchdb services endpoint(s)

func CreateOAuth2Handler

func CreateOAuth2Handler(ctx context.Context) (func(next http.HandlerFunc) http.HandlerFunc, error)

CreateOAuth2Handler in given context, creates an oauth2 verifier, and returns a middleware

func CreateRouter

func CreateRouter(ctx context.Context) (http.Handler, error)

CreateRouter returns a ready to use router

func HealthHandler

func HealthHandler(w http.ResponseWriter, r *http.Request)

HealthHandler reports the health status for the entire application or a specific component

func IndexHandler

func IndexHandler(w http.ResponseWriter, r *http.Request)

IndexHandler is the default response a curious user will see

func MethodNotAllowedHandler

func MethodNotAllowedHandler(w http.ResponseWriter, r *http.Request)

MethodNotAllowedHandler sets the HTTP status and finishes

func NotFoundHandler

func NotFoundHandler(w http.ResponseWriter, r *http.Request)

NotFoundHandler sets the HTTP status and finishes

func SelfServiceSeedHandler

func SelfServiceSeedHandler(w http.ResponseWriter, r *http.Request)

SelfServiceSeedHandler creates initial couchdb resources if not already present

func SendJSON

func SendJSON(w http.ResponseWriter, status int, payload interface{}) error

SendJSON response for the given response writer, if an error occurs and 500 is returned to the client and the error is given back if further error handling is required. The cause for the error is also logged.

Types

type AuthErrorResponse

type AuthErrorResponse struct {
	Message string `json:"message"`
}

AuthErrorResponse is the representation of an oauth error

Jump to

Keyboard shortcuts

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