Skip to content
This repository has been archived by the owner on Mar 2, 2024. It is now read-only.

Commit

Permalink
✅ Add dynamic port for server side
Browse files Browse the repository at this point in the history
  • Loading branch information
deifyed committed Mar 24, 2021
1 parent d8fb312 commit 9a8fc91
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions docs/release_notes/0.0.52.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Release 0.0.52

## Features

## Bugfixes

## Other

#421 Acquire free port from OS for server side
9 changes: 8 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"path/filepath"
"time"

"github.com/rancher/k3d/v3/cmd/util"

"github.com/oslokommune/okctl/pkg/config/constant"

"github.com/oslokommune/okctl/pkg/client/store"
Expand Down Expand Up @@ -52,7 +54,12 @@ type Config struct {

// New Config initialises a default okctl configuration
func New() *Config {
dest := "127.0.0.1:8085"
port, err := util.GetFreePort()
if err != nil {
port = 8085
}

dest := fmt.Sprintf("127.0.0.1:%d", port)

return &Config{
Context: context.New(),
Expand Down

0 comments on commit 9a8fc91

Please sign in to comment.