Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions dockercompose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dockercompose

import (
"fmt"
"net/url"
"os"
"path/filepath"
"regexp"
Expand All @@ -10,7 +11,6 @@ import (

"github.com/nhost/be/services/mimir/model"
"github.com/nhost/cli/ssl"
"net/url"
)

const (
Expand Down Expand Up @@ -205,21 +205,32 @@ func trafikFiles(dotnhostfolder string) error {
return nil
}

func getDockerHost() (string, error) {
socket, ok := os.LookupEnv("DOCKER_HOST")
if !ok {
return "/var/run/docker.sock", nil
}

u, err := url.Parse(socket)
if err != nil {
return "", fmt.Errorf("failed to parse DOCKER_HOST: %w", err)
}
if u.Scheme != "unix" {
return "", fmt.Errorf( //nolint:err113
"unsupported scheme %s in DOCKER_HOST, only unix supported",
u.Scheme,
)
}
return u.Path, nil
}

func traefik(subdomain, projectName string, port uint, dotnhostfolder string) (*Service, error) {
if err := trafikFiles(dotnhostfolder); err != nil {
return nil, fmt.Errorf("failed to create traefik files: %w", err)
}
path := "/var/run/docker.sock"
socket, ok := os.LookupEnv("DOCKER_HOST")
if ok {
u, err := url.Parse(socket)
if err != nil {
return nil, fmt.Errorf("failed to parse DOCKER_HOST: %w", err)
}
if u.Scheme != "unix" {
return nil, fmt.Errorf("unsupported scheme %s in DOCKER_HOST, only unix supported", u.Scheme)
}
path = u.Path
path, err := getDockerHost()
if err != nil {
return nil, fmt.Errorf("failed to get docker host: %w", err)
}

return &Service{
Expand Down
Loading