Lasa is a stateless proxy that generates a RSS or an Atom feed from a Standard.site publication. lasa.anhgelus.world
rss atom atprotocol standard-site atproto
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(cli): use nyttikord/logos as logger

+20 -4
+11
cmd/lasad/main.go
··· 2 2 3 3 import ( 4 4 "flag" 5 + "log/slog" 5 6 "os" 6 7 8 + "github.com/nyttikord/logos" 7 9 "tangled.org/anhgelus.world/lasa/cmd/internal" 8 10 "tangled.org/anhgelus.world/lasa/cmd/lasad/config" 9 11 ) ··· 11 13 var ( 12 14 flags *flag.FlagSet 13 15 help = false 16 + verbose = false 17 + noColor = false 14 18 configPath = config.DefaultPath 15 19 ) 16 20 17 21 func init() { 18 22 flags = flag.NewFlagSet("default", flag.PanicOnError) 19 23 flags.BoolVar(&help, "h", help, "display the help") 24 + flags.BoolVar(&verbose, "v", verbose, "increase verbosity") 25 + flags.BoolVar(&noColor, "no-color", noColor, "disable colors") 20 26 flags.StringVar(&configPath, "c", configPath, "path to the config") 21 27 } 22 28 ··· 31 37 handleHelp() 32 38 return 33 39 } 40 + logOpts := &logos.Options{PrintStackTrace: true, DisableColor: noColor} 41 + if verbose { 42 + logOpts.Level = slog.LevelDebug 43 + } 44 + slog.SetDefault(slog.New(logos.New(os.Stdout, logOpts))) 34 45 args := flags.Args() 35 46 command := "run" 36 47 if len(args) > 0 {
+1 -3
cmd/lasad/run.go
··· 9 9 "net/http" 10 10 "os" 11 11 "os/signal" 12 - "runtime/debug" 13 12 "strings" 14 13 "syscall" 15 14 "time" ··· 163 162 now := time.Now() 164 163 defer func() { 165 164 if err := recover(); err != nil { 166 - debug.PrintStack() 167 165 w.WriteHeader(http.StatusInternalServerError) 168 - log.Error("panic! (stack trace printed to stderr)", "duration", time.Since(now)) 166 + log.Error("panic!", "error", err, "duration", time.Since(now)) 169 167 } 170 168 }() 171 169
+1
go.mod
··· 4 4 5 5 require ( 6 6 github.com/BurntSushi/toml v1.6.0 7 + github.com/nyttikord/logos v0.1.0 7 8 github.com/valkey-io/valkey-glide/go/v2 v2.3.1 8 9 tangled.org/anhgelus.world/goat-site v0.1.3 9 10 tangled.org/anhgelus.world/xrpc v0.4.0
+2
go.sum
··· 6 6 github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= 7 7 github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= 8 8 github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 9 + github.com/nyttikord/logos v0.1.0 h1:uInB616bOrl7SvR6Bsv5Axjp7YHa57tidnyXRqp+cas= 10 + github.com/nyttikord/logos v0.1.0/go.mod h1:gtgElduSi9ThHQ3kGMbf2rUXmU2ypwmvCRt8ivdWW+s= 9 11 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 10 12 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 11 13 github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
+1 -1
justfile
··· 6 6 7 7 dev: 8 8 if [[ ! -f {{testConfig}} ]]; then go run ./cmd/lasad/ gen-config -c {{testConfig}}; fi 9 - go run ./cmd/lasad/ -c {{testConfig}} 9 + go run ./cmd/lasad/ -c {{testConfig}} -v 10 10 11 11 valkey: 12 12 {{docker}} run --rm --name {{valkey_container}} -p 6379:6379 -d docker.io/valkey/valkey:alpine
+4
lasad.1.scd
··· 27 27 28 28 *-c* specifies the path to the config. Default: */etc/lasad.toml*. 29 29 30 + *-v* increases verbosity (DEBUG is logged). 31 + 32 + *-no-color* disables colors in logs. 33 + 30 34 *-h* prints the help. 31 35 32 36 # CONFIGURATION