site

package
v0.27.3 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: AGPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractOrReadBinFS added in v0.7.4

func ExtractOrReadBinFS(dest string, siteFS fs.FS) (http.FileSystem, map[string]string, error)

ExtractOrReadBinFS checks the provided fs for compressed coder binaries and extracts them into dest/bin if found. As a fallback, the provided FS is checked for a /bin directory, if it is non-empty it is returned. Finally dest/bin is returned as a fallback allowing binaries to be manually placed in dest (usually ${CODER_CACHE_DIRECTORY}/site/bin).

Returns a http.FileSystem that serves unpacked binaries, and a map of binary name to SHA1 hash. The returned hash map may be incomplete or contain hashes for missing files.

func FS added in v0.6.1

func FS() fs.FS

func RenderStaticErrorPage added in v0.9.3

func RenderStaticErrorPage(rw http.ResponseWriter, r *http.Request, data ErrorPageData)

RenderStaticErrorPage renders the static error page. This is used by app requests to avoid dependence on the dashboard but maintain the ability to render a friendly error page on subdomains.

func ShouldCacheFile added in v0.6.1

func ShouldCacheFile(reqFile string) bool

Types

type ErrorPageData added in v0.9.3

type ErrorPageData struct {
	Status int
	// HideStatus will remove the status code from the page.
	HideStatus   bool
	Title        string
	Description  string
	RetryEnabled bool
	DashboardURL string
}

ErrorPageData contains the variables that are found in site/static/error.html.

type Handler added in v0.6.1

type Handler struct {
	AppearanceFetcher func(ctx context.Context) (codersdk.AppearanceConfig, error)
	// RegionsFetcher will attempt to fetch the more detailed WorkspaceProxy data, but will fall back to the
	// regions if the user does not have the correct permissions.
	RegionsFetcher func(ctx context.Context) (any, error)

	Entitlements atomic.Pointer[codersdk.Entitlements]
	Experiments  atomic.Pointer[codersdk.Experiments]
	// contains filtered or unexported fields
}

func New added in v0.25.0

func New(opts *Options) *Handler

func (*Handler) ServeHTTP added in v0.25.0

func (h *Handler) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type Options added in v0.25.0

type Options struct {
	BinFS         http.FileSystem
	BinHashes     map[string]string
	Database      database.Store
	SiteFS        fs.FS
	OAuth2Configs *httpmw.OAuth2Configs
	DocsURL       string
}

Jump to

Keyboard shortcuts

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