Skip to content

Commit

Permalink
Remove Docker client dependency from standalone run (#1443)
Browse files Browse the repository at this point in the history
Signed-off-by: joshvanl <[email protected]>
  • Loading branch information
JoshVanL authored Aug 15, 2024
1 parent 027f5da commit e08443b
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions pkg/standalone/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ limitations under the License.
package standalone

import (
"context"
"fmt"
"net"
"os"
Expand All @@ -24,8 +23,6 @@ import (
"strconv"
"strings"

dockerClient "github.com/docker/docker/client"

"github.com/Pallinder/sillyname-go"
"github.com/phayes/freeport"
"gopkg.in/yaml.v2"
Expand Down Expand Up @@ -141,27 +138,21 @@ func (config *RunConfig) validatePlacementHostAddr() error {
}

func (config *RunConfig) validateSchedulerHostAddr() error {
// If the scheduler isn't running - don't add the flag to the runtime cmd.
docker, err := dockerClient.NewClientWithOpts()
if err != nil {
return err
schedulerHostAddr := config.SchedulerHostAddress
if len(schedulerHostAddr) == 0 {
return nil
}
_, err = docker.ContainerInspect(context.Background(), "dapr_scheduler")
if err == nil {
schedulerHostAddr := config.SchedulerHostAddress
if len(schedulerHostAddr) == 0 {
schedulerHostAddr = "localhost"
}
if indx := strings.Index(schedulerHostAddr, ":"); indx == -1 {
if runtime.GOOS == daprWindowsOS {
schedulerHostAddr = fmt.Sprintf("%s:6060", schedulerHostAddr)
} else {
schedulerHostAddr = fmt.Sprintf("%s:50006", schedulerHostAddr)
}

if indx := strings.Index(schedulerHostAddr, ":"); indx == -1 {
if runtime.GOOS == daprWindowsOS {
schedulerHostAddr = fmt.Sprintf("%s:6060", schedulerHostAddr)
} else {
schedulerHostAddr = fmt.Sprintf("%s:50006", schedulerHostAddr)
}
config.SchedulerHostAddress = schedulerHostAddr
return nil
}

config.SchedulerHostAddress = schedulerHostAddr

return nil
}

Expand Down

0 comments on commit e08443b

Please sign in to comment.