33 lines
547 B
Go
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
|
|
})
|