discovery

package
v0.3.21 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package discovery serves the builder discovery document. (/.well-known/builder-configuration).

Index

Constants

View Source
const DefaultTimeout = 30 * time.Second

DefaultTimeout is the default timeout for the Perplexity API.

View Source
const WellKnownConfigurationURL = "/.well-known/builder-configuration"

WellKnownConfiguratonURL returns the URL of the well-known configuration.

Variables

View Source
var DefaultClient = &http.Client{
	Timeout: DefaultTimeout,
}

DefaultClient is the default HTTP client for the Perplexity API.

Functions

func New

func New(config ...Config) fiber.Handler

New creates a discovery middleware handler.

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.

func NewClient

func NewClient(opts ...Option) Client

NewClient returns a new discovery client.

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

func WithClient(client *http.Client) Option

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.

Jump to

Keyboard shortcuts

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