config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultIntervalsBaseURL = defaultIntervalsBaseURL

Variables

View Source
var (
	ErrMissingAPIKey    = errors.New("INTERVALS_ICU_API_KEY is required")
	ErrMissingAthleteID = errors.New("INTERVALS_ICU_ATHLETE_ID is required")
)

ErrMissingAPIKey and ErrMissingAthleteID are returned (wrapped via errors.Join) by ValidateIntervals so callers can detect the first-run "no credentials yet" case with errors.Is instead of matching error text.

Functions

func ConfigPath

func ConfigPath(opts DiscoveryOptions) (string, error)

func IsMissingIntervalsCredentials

func IsMissingIntervalsCredentials(err error) bool

func LoadDiscovered

func LoadDiscovered(opts DiscoveryOptions) (Config, Source, error)

func LoadEffective

func LoadEffective(opts DiscoveryOptions) (Config, Source, error)

func LoadIntervalsDiscovered

func LoadIntervalsDiscovered(opts DiscoveryOptions) (Config, Source, error)

func WriteIntervalsConfig

func WriteIntervalsConfig(path string, creds IntervalsCredentials, overwrite bool) error

Types

type Config

type Config struct {
	IntervalsAPIKey    string
	IntervalsAthleteID string
	IntervalsBaseURL   string

	MCPAddr        string
	MCPPublicURL   string
	RequiredScopes []string

	SupabaseURL            string
	SupabaseAnonKey        string
	SupabaseOAuthProviders []string

	OIDCIssuerURL    string
	OIDCJWKSURL      string
	OIDCAudience     string
	OIDCAllowedEmail string
	OIDCAllowedSub   string
	RequestTimeout   time.Duration
	ShutdownTimeout  time.Duration
}

func (Config) MCPResource

func (c Config) MCPResource() string

func (Config) ResourceMetadataURL

func (c Config) ResourceMetadataURL() string

func (Config) Validate

func (c Config) Validate() error

func (Config) ValidateIntervals

func (c Config) ValidateIntervals() error

type DiscoveryOptions

type DiscoveryOptions struct {
	EnvPath     string
	EnvExplicit bool
	WorkDir     string
}

type IntervalsCredentials

type IntervalsCredentials struct {
	APIKey    string
	AthleteID string
	BaseURL   string
}

type Source

type Source struct {
	Kind   SourceKind
	Path   string
	Exists bool
}

func Discover

func Discover(opts DiscoveryOptions) (Source, error)

type SourceKind

type SourceKind string
const (
	SourceNone     SourceKind = "none"
	SourceExplicit SourceKind = "explicit"
	SourceXDG      SourceKind = "xdg"
	SourceLocal    SourceKind = "local"
)

Jump to

Keyboard shortcuts

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