server

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port           string         `env:"PORT" envDefault:"8080"`
	BaseURL        string         `env:"BASE_URL,required"`
	Whoop          Whoop          `envPrefix:"WHOOP_"`
	RateLimit      RateLimit      `envPrefix:"RATE_"`
	WhoopRateLimit WhoopRateLimit `envPrefix:"WHOOP_RATE_LIMIT_"`
	Redis          Redis          `envPrefix:"REDIS_"`
	Database       Database       `envPrefix:"DATABASE_"`
}

func ReadConfig

func ReadConfig() (Config, error)

func (Config) GetClientID

func (c Config) GetClientID() string

func (Config) GetClientSecret

func (c Config) GetClientSecret() string

func (Config) GetRedirectURL

func (c Config) GetRedirectURL() string

type Database

type Database struct {
	URL string `env:"URL,required"`
}

type RateLimit

type RateLimit struct {
	Limit float64 `env:"LIMIT" envDefault:"10"`
	Burst int     `env:"BURST" envDefault:"20"`
}

type Redis

type Redis struct {
	URL string `env:"URL"`
}

type Whoop

type Whoop struct {
	ClientID     string `env:"CLIENT_ID,required"`
	ClientSecret string `env:"CLIENT_SECRET,required"`
}

type WhoopRateLimit

type WhoopRateLimit struct {
	// max 10 users as unapproved app, assumes ~5 concurrent
	PerUserMinuteLimit int `env:"PER_USER_MINUTE_LIMIT" envDefault:"20"`
	PerUserDayLimit    int `env:"PER_USER_DAY_LIMIT" envDefault:"2000"`

	// w/ safety buffers from WHOOP's 100/min, 10k/day
	GlobalMinuteLimit int `env:"GLOBAL_MINUTE_LIMIT" envDefault:"95"`
	GlobalDayLimit    int `env:"GLOBAL_DAY_LIMIT" envDefault:"9950"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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