Skip to content

Commit

Permalink
more config; ability to disable refresh identity endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
bnewbold committed Feb 27, 2025
1 parent 78086cc commit f09d07a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
16 changes: 12 additions & 4 deletions cmd/domesday/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func run(args []string) error {
&cli.IntFlag{
Name: "plc-rate-limit",
Usage: "max number of requests per second to PLC registry",
Value: 100,
Value: 300,
EnvVars: []string{"DOMESDAY_PLC_RATE_LIMIT"},
},
&cli.StringFlag{
Expand Down Expand Up @@ -87,6 +87,11 @@ func run(args []string) error {
Usage: "don't consume #identity events from firehose",
EnvVars: []string{"DOMESDAY_DISABLE_FIREHOSE_CONSUMER"},
},
&cli.BoolFlag{
Name: "disable-refresh",
Usage: "disable the refreshIdentity API endpoint",
EnvVars: []string{"DOMESDAY_DISABLE_REFRESH"},
},
&cli.IntFlag{
Name: "firehose-parallelism",
Usage: "number of concurrent firehose workers",
Expand Down Expand Up @@ -188,9 +193,12 @@ func runServeCmd(cctx *cli.Context) error {

srv, err := NewServer(
Config{
Logger: logger,
Bind: cctx.String("bind"),
RedisURL: cctx.String("redis-url"),
Logger: logger,
Bind: cctx.String("bind"),
RedisURL: cctx.String("redis-url"),
PLCHost: cctx.String("atp-plc-host"),
PLCRateLimit: cctx.Int("plc-rate-limit"),
DisableRefresh: cctx.Bool("disable-refresh"),
},
)
if err != nil {
Expand Down
15 changes: 9 additions & 6 deletions cmd/domesday/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ type Server struct {
}

type Config struct {
Logger *slog.Logger
PLCHost string
PLCRateLimit int
RedisURL string
Bind string
Logger *slog.Logger
PLCHost string
PLCRateLimit int
RedisURL string
Bind string
DisableRefresh bool
}

func NewServer(config Config) (*Server, error) {
Expand Down Expand Up @@ -136,7 +137,9 @@ func NewServer(config Config) (*Server, error) {
e.GET("/xrpc/com.atproto.identity.resolveHandle", srv.ResolveHandle)
e.GET("/xrpc/com.atproto.identity.resolveDid", srv.ResolveDid)
e.GET("/xrpc/com.atproto.identity.resolveIdentity", srv.ResolveIdentity)
e.POST("/xrpc/com.atproto.identity.refreshIdentity", srv.RefreshIdentity)
if !config.DisableRefresh {
e.POST("/xrpc/com.atproto.identity.refreshIdentity", srv.RefreshIdentity)
}

return srv, nil
}
Expand Down

0 comments on commit f09d07a

Please sign in to comment.