Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrParse = errors.New("failed to parse environment variables")
ErrParse is joined with the backend's error when Parse fails, so a caller can tell a configuration problem from anything else with errors.Is.
var ErrParseWithPrefix = errors.New("failed to parse environment variables for the given prefix")
ErrParseWithPrefix is joined with the backend's error when ParseWithPrefix fails, so a caller can tell a configuration problem from anything else with errors.Is.
Functions ¶
func AnnouncementFor ¶ added in v0.27.0
AnnouncementFor returns the SSH connection banner for the given edition.
func Parse ¶ added in v0.13.3
Parse fills a T from the envconfig tags on its fields, reading each key from backend. It returns ErrParse, joined with the cause, when a required key is missing or a value does not decode.
func ParseWithPrefix ¶ added in v0.13.0
ParseWithPrefix fills a T from the envconfig tags on its fields, reading each key from backend under prefix before falling back to the unprefixed key. It returns ErrParseWithPrefix, joined with the cause, when a required key is missing or a value does not decode.
Types ¶
type Backend ¶
Backend is where a configuration is parsed from: the process environment (OS) or, in a test, a map (Map).
type Edition ¶ added in v0.27.0
type Edition string
Edition is the ShellHub edition an instance runs as. It decides which features the server exposes, so it is read at startup and never per request.
const ( // Community is the open-source edition, and the edition an instance falls back to when // SHELLHUB_EDITION is unset. Community Edition = "community" // Enterprise is the self-hosted paid edition, gated by a licence file. Enterprise Edition = "enterprise" // Cloud is the hosted edition, which adds billing and the multi-tenant surface on top of // Enterprise. Cloud Edition = "cloud" )
func ParseEdition ¶ added in v0.27.0
ParseEdition normalizes raw (trim and lowercase) into an Edition. The empty string is Community; anything else outside the three editions is an error.
func (Edition) IsCloud ¶ added in v0.27.0
IsCloud reports whether e is the hosted edition. Billing and namespace limits are the features that turn on here and nowhere else.
func (Edition) IsCommunity ¶ added in v0.27.0
IsCommunity reports whether e is the community edition. The zero value is community too, so an edition nobody set behaves as an unset SHELLHUB_EDITION does.
func (Edition) IsEnterprise ¶ added in v0.27.0
IsEnterprise reports whether e is the enterprise edition, which is not the same question as "may it use a paid feature"; see IsEnterpriseOrCloud.
func (Edition) IsEnterpriseOrCloud ¶ added in v0.27.0
IsEnterpriseOrCloud reports whether the paid feature set is available. This is the check a feature gate wants, so that a feature added for cloud stays available to enterprise.
func (*Edition) UnmarshalText ¶ added in v0.27.0
UnmarshalText parses text with ParseEdition, so a config struct that declares an Edition field rejects a bad SHELLHUB_EDITION when it is parsed.
type OpenAPIValidation ¶ added in v0.27.0
type OpenAPIValidation string
OpenAPIValidation is how the server treats a response that does not match its schema.
const ( // OpenAPIValidationOff checks nothing. OpenAPIValidationOff OpenAPIValidation = "off" // OpenAPIValidationReport logs a mismatch and answers as the handler did. OpenAPIValidationReport OpenAPIValidation = "report" // OpenAPIValidationStrict answers a mismatch with a 500 that lists it and refuses to start // without a schema. OpenAPIValidationStrict OpenAPIValidation = "strict" )
func OpenAPIValidationMode ¶ added in v0.27.0
func OpenAPIValidationMode(raw string, development bool) OpenAPIValidation
OpenAPIValidationMode turns the raw SHELLHUB_OPENAPI_VALIDATION into a mode. on, true, 1 and report log a mismatch, strict fails it, and off, false and 0 disable the check. Anything else reports in development and is off elsewhere.