agendas/main.go
2024-12-30 17:30:37 -05:00

42 lines
711 B
Go

package main
import (
"context"
"net/http"
"codeberg.org/vlbeaudoin/voki/v3"
"git.agecem.com/bottin/bottin/v10/pkg/bottin"
)
// Entry
func main() {
// Start commandline parsing then call `run`
Execute()
}
func run(ctx context.Context, cfg Config) error {
select {
case <-ctx.Done():
return ctx.Err()
default:
bottinClient := bottin.APIClient{Caller: voki.New(
http.DefaultClient,
cfg.Bottin.Host,
cfg.Bottin.Key,
cfg.Bottin.Port,
func() string {
if cfg.Bottin.TLS.Enabled {
return "https"
} else {
return "http"
}
}(),
)}
if err := RunServer(ctx, cfg, &bottinClient); err != nil && err != http.ErrServerClosed {
return err
}
return nil
}
}