go-paste/app.paste.go

33 lines
547 B
Go
Raw Permalink Normal View History

2023-10-19 17:05:41 -06:00
package main
import (
"context"
"strconv"
"go.sour.is/pkg/env"
"go.sour.is/pkg/lg"
"go.sour.is/pkg/service"
"go.sour.is/paste/v2/paste"
)
var _ = apps.Register(50, func(ctx context.Context, svc *service.Harness) error {
_, span := lg.Span(ctx)
defer span.End()
store := env.Default("PASTE_STORE", "data/")
randBytes, err := strconv.ParseInt(env.Default("PASTE_RANDOM", "4096"), 10, 32)
if err != nil {
return err
}
2024-01-22 16:05:13 -07:00
srv, err := paste.NewService(store, randBytes)
2023-10-19 17:05:41 -06:00
if err != nil {
return err
}
2024-01-22 16:05:13 -07:00
svc.Add(srv)
2023-10-19 17:05:41 -06:00
return nil
})