this repo has no description
0
fork

Configure Feed

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

make jetstream server addr an env variable

+9 -11
-8
handler_test.go
··· 3 3 import ( 4 4 "context" 5 5 "encoding/json" 6 - "fmt" 7 6 "testing" 8 7 "time" 9 8 ··· 14 13 "github.com/stretchr/testify/require" 15 14 "github.com/willdot/bskyfeedgen/store" 16 15 ) 17 - 18 - func TestIt(t *testing.T) { 19 - ti := time.Now().Add(-time.Minute * 60) 20 - 21 - fmt.Println(ti.UnixMicro()) 22 - t.FailNow() 23 - } 24 16 25 17 func TestHandlerReceivesSubscribeMessage(t *testing.T) { 26 18 db, err := store.New(":memory:")
+9 -3
main.go
··· 16 16 ) 17 17 18 18 const ( 19 - jsServerAddr = "wss://jetstream.atproto.tools/subscribe" 19 + defaultServerAddr = "wss://jetstream.atproto.tools/subscribe" 20 20 ) 21 21 22 22 func main() { ··· 71 71 72 72 if enableJS == "true" { 73 73 slog.Info("enabling jetstream consume") 74 - go consumeLoop(ctx, jsServerAddr, store) 74 + go consumeLoop(ctx, store) 75 75 } 76 76 77 77 server := NewServer(443, feeder, feedHost, feedDidBase) ··· 87 87 time.Sleep(time.Second) 88 88 } 89 89 90 - func consumeLoop(ctx context.Context, jsServerAddr string, store *store.Store) { 90 + func consumeLoop(ctx context.Context, store *store.Store) { 91 91 handler := handler{ 92 92 store: store, 93 93 } 94 + 95 + jsServerAddr := os.Getenv("JS_SERVER_ADDR") 96 + if jsServerAddr == "" { 97 + jsServerAddr = defaultServerAddr 98 + } 99 + 94 100 consumer := NewConsumer(jsServerAddr, slog.Default(), &handler) 95 101 96 102 retry.Do(func() error {