go-paste/app.paste.go
xuu f9c064e948
Some checks failed
Go Test / test (push) Failing after 32s
Go Bump / bump (push) Successful in 34s
refactor: move into package
2024-01-22 16:05:13 -07:00

33 lines
547 B
Go

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
}
srv, err := paste.NewService(store, randBytes)
if err != nil {
return err
}
svc.Add(srv)
return nil
})