Documentation
¶
Overview ¶
Package discovery serves the builder discovery document. (/.well-known/builder-configuration).
Index ¶
Constants ¶
const DefaultTimeout = 30 * time.Second
DefaultTimeout is the default timeout for the Perplexity API.
const WellKnownConfigurationURL = "/.well-known/builder-configuration"
WellKnownConfiguratonURL returns the URL of the well-known configuration.
Variables ¶
var DefaultClient = &http.Client{ Timeout: DefaultTimeout, }
DefaultClient is the default HTTP client for the Perplexity API.
Functions ¶
Types ¶
type Client ¶
type Client interface {
// Discover returns the well-known configuration for the given base URL.
Discover(ctx context.Context, baseURL string) (*WellKnownConfig, error)
}
Client is an interface for discovering services.
type Config ¶
type Config struct {
// Next defines a function to skip this middleware when returned true.
//
// Optional. Default: nil
Next func(c fiber.Ctx) bool
// WellKnownFunc returns the well-known configuration.
//
// Optional. Default: nil
WellKnownFunc func() WellKnownConfig
}
Config holds the Discovery configuration.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default Discovery configuration.
type Option ¶
type Option func(*discoveryClient)
Option is a function that configures the discovery client.
func WithClient ¶
WithClient returns an Option that sets the HTTP client for the discovery client.
type WellKnownConfig ¶
type WellKnownConfig struct {
// OidcIssuer is the URL to the OIDC issuer.
//
// Default: "http://builder.internal:5556/dex"
OidcIssuer string `json:"oidc_issuer"`
// ApiURL is the URL to the API.
//
// Default: "http://builder.internal:8080/api/v1"
ApiURL string `json:"api_url"`
}
WellKnownConfig holds the well-known configuration.
func DefaultWellKnownConfig ¶
func DefaultWellKnownConfig() WellKnownConfig
DefaultWellKnownConfig returns the default well-known configuration.
func DefaultWellKnownFunc ¶
func DefaultWellKnownFunc() WellKnownConfig
DefaultWellKnownFunc returns the default well-known configuration function.