server

package
v0.0.0-...-c9b5d2c Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ReloadRoute = "/dev/reload"

Variables

View Source
var ErrContinueLater = errors.New("continue later")

Functions

This section is empty.

Types

type Config

type Config struct {
	Dev                        bool                `toml:"dev"`
	WarnUnknownEventCategories bool                `toml:"warn_unknown_event_categories"`
	Log                        LogConfig           `toml:"log"`
	Server                     ServerConfig        `toml:"server"`
	Database                   database.Config     `toml:"database"`
	Campfire                   campfire.Config     `toml:"campfire"`
	DiscordAuth                auth.Config         `toml:"discord_auth"`
	CampfireAuth               cauth.Config        `toml:"campfire_auth"`
	Notifications              NotificationsConfig `toml:"notifications"`
}

func LoadConfig

func LoadConfig(cfgPath string) (Config, error)

func (Config) String

func (c Config) String() string

type LogConfig

type LogConfig struct {
	Level     slog.Level `toml:"level"`
	Format    LogFormat  `toml:"format"`
	AddSource bool       `toml:"add_source"`
}

func (LogConfig) String

func (c LogConfig) String() string

type LogFormat

type LogFormat string
const (
	LogFormatJSON LogFormat = "json"
	LogFormatText LogFormat = "text"
)

type NotificationsConfig

type NotificationsConfig struct {
	Enabled    bool   `toml:"enabled"`
	WebhookURL string `toml:"webhook_url"`
}

func (NotificationsConfig) String

func (c NotificationsConfig) String() string

type Server

type Server struct {
	Cfg                    Config
	TrackerServer          *http.Server
	RewardsServer          *http.Server
	HttpClient             *http.Client
	Campfire               *campfire.Client
	DB                     *database.Database
	Auth                   *auth.Auth
	CampfireAuth           *cauth.Auth
	Templates              func() *template.Template
	StaticFS               http.FileSystem
	WebhookClient          *webhook.Client
	SentTokenNotifications []int
	Reloader               *goreload.Reloader
}

func New

func New(cfg Config) (*Server, error)

func (*Server) ProcessEventImport

func (s *Server) ProcessEventImport(ctx context.Context, event campfire.Event, members []campfire.Member, skipClub bool) error

func (*Server) ProcessFullEventImport

func (s *Server) ProcessFullEventImport(ctx context.Context, event campfire.Event, skipClub bool) error

func (*Server) SendNotification

func (s *Server) SendNotification(ctx context.Context, content string)

func (*Server) Start

func (s *Server) Start(trackerHandler http.Handler, rewardsHandler http.Handler)

func (*Server) Stop

func (s *Server) Stop()

type ServerConfig

type ServerConfig struct {
	TrackerAddr      string `toml:"tracker_addr"`
	PublicTrackerURL string `toml:"public_tracker_url"`
	RewardsAddr      string `toml:"rewards_addr"`
	PublicRewardsURL string `toml:"public_rewards_url"`
}

func (ServerConfig) String

func (c ServerConfig) String() string

Directories

Path Synopsis
web

Jump to

Keyboard shortcuts

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