Documentation
¶
Overview ¶
Package epaddr is where an endpoint answers (#2822): the one computation of an endpoint's URLs, which manage_script handler_list's url and an application's environment cards both read, so the two cannot disagree.
An application endpoint answers in every environment of its application: on the platform's own host at /endpoints/<name> for the last environment and at /environments/<env>/endpoints/<name> for any other (#2696); on the application's page origin and the domains mapped to the application, for the last environment, at /endpoints/<name> and, for the endpoint named like the application, at the root (#2559); and on the address of each site environment that is a part of the application at /endpoints/<name>, running the application environment of the site environment's name (#2679, #2709).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForApplication ¶
func ForApplication(ctx context.Context, s Source, a *application.Application) map[string][]Endpoint
ForApplication is, by environment name, the endpoints each environment of a serves and the URLs each answers at there; every environment is present, with an empty list when the application holds no endpoint. A script whose bindings cannot be read is left out.
func PlatformURL ¶
PlatformURL is where a binding answers on the platform's own host in an application environment: env "" is the last, served at /endpoints/<name>. manage_script handler_list reports this as url.
Types ¶
type Endpoint ¶
type Endpoint struct {
Name string `json:"name" example:"research"`
Script string `json:"script" example:"research-api"`
Methods []string `json:"methods" example:"GET"`
AuthMode string `json:"auth_mode" example:"public"`
Path string `json:"path" example:"/{route...}"`
URLs []string `json:"urls"`
}
Endpoint is one endpoint an application environment serves, and every URL it answers at there.
type Hosts ¶
type Hosts struct {
// BaseURL is the platform's public address, "" for none.
BaseURL string
// App is the application's name: the endpoint of that name answers at
// the root of its page origins.
App string
// PageOrigins are the application's page origin, when the deployment has
// a pages domain, and the origins of the domains mapped to it. They run
// the last environment.
PageOrigins []string
// Sites are the origins of the application's site environment parts, by
// the site environment's name, which is the application environment they
// run.
Sites map[string][]string
}
Hosts is every origin an application's endpoints answer on.
type Source ¶
type Source struct {
// ByScript is a script's bindings.
ByScript func(ctx context.Context, scriptID string) ([]epbinding.Binding, error)
// ScriptName is a script's name, "" when unknown.
ScriptName func(ctx context.Context, scriptID string) string
// Hosts is the origins the application answers on.
Hosts func(ctx context.Context, a *application.Application) Hosts
}
Source is what the endpoints of an application are read from.