Skip to content

Commit

Permalink
use short local key for controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
matt2e committed Mar 13, 2024
1 parent dddcac7 commit 7a20a33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/ftl/cmd_serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/TBD54566975/ftl/internal/bind"
"github.com/TBD54566975/ftl/internal/exec"
"github.com/TBD54566975/ftl/internal/log"
"github.com/TBD54566975/ftl/internal/model"
"github.com/TBD54566975/ftl/internal/rpc"
"github.com/TBD54566975/ftl/internal/slices"
)
Expand Down Expand Up @@ -101,6 +102,7 @@ func (s *serveCmd) Run(ctx context.Context) error {
i := i
config := controller.Config{
Bind: controllerAddresses[i],
Key: model.NewLocalControllerKey(i + 1),
DSN: dsn,
AllowOrigins: s.AllowOrigins,
NoConsole: s.NoConsole,
Expand Down
5 changes: 5 additions & 0 deletions internal/model/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ func NewControllerKey(hostname string, port string) ControllerKey {
Suffix: int(suffix.Int64()),
}
}
func NewLocalControllerKey(suffix int) ControllerKey {
return keyType[controllerKey]{
Suffix: suffix,
}
}
func ParseControllerKey(key string) (ControllerKey, error) { return parseKey[ControllerKey](key, true) }

type controllerKey struct{}
Expand Down

0 comments on commit 7a20a33

Please sign in to comment.