Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

feat: added support for non-unix docker endpoints#971

Merged
dbarrosop merged 1 commit into
mainfrom
docker-host
Jul 1, 2025
Merged

feat: added support for non-unix docker endpoints#971
dbarrosop merged 1 commit into
mainfrom
docker-host

Conversation

@dbarrosop
Copy link
Copy Markdown
Member

@dbarrosop dbarrosop commented Jul 1, 2025

User description

Fixes #970


PR Type

Enhancement


Description

  • Added support for non-unix Docker endpoints in DOCKER_HOST

  • Refactored Docker host parsing to accept multiple schemes

  • Dynamically set Traefik Docker provider endpoint based on scheme

  • Updated example nhost.toml to newer auth version


Changes diagram

flowchart LR
  A["getDockerHost() now returns *url.URL"] -- "Supports unix & tcp" --> B["traefik() uses dockerURL"]
  B -- "Sets endpoint & volumes dynamically" --> C["Traefik service config"]
  D["examples/myproject/nhost.toml"] -- "Bump auth version" --> E["auth.version = '0.40.0'"]
Loading

Changes walkthrough 📝

Relevant files
Enhancement
compose.go
Add support for tcp and other Docker host schemes               

dockercompose/compose.go

  • Refactored getDockerHost() to return a *url.URL and support non-unix
    schemes
  • Updated Traefik service to dynamically set Docker endpoint and volumes
  • Removed restriction on only unix scheme for Docker host
  • Improved error handling and configuration flexibility
  • +28/-26 
    Configuration changes
    nhost.toml
    Bump auth version in example configuration                             

    examples/myproject/nhost/nhost.toml

    • Updated auth.version from '0.37.1' to '0.40.0'
    +1/-1     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @github-actions
    Copy link
    Copy Markdown
    Contributor

    github-actions Bot commented Jul 1, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Handle error from URL parsing

    The error returned by url.Parse is being ignored, which could mask parsing issues.
    Handle the error explicitly to avoid unexpected panics or silent failures.

    dockercompose/compose.go [211-212]

    -u, _ := url.Parse("unix:///var/run/docker.sock")
    +u, err := url.Parse("unix:///var/run/docker.sock")
    +if err != nil {
    +    return nil, fmt.Errorf("failed to parse default unix socket: %w", err)
    +}
     return u, nil
    Suggestion importance[1-10]: 7

    __

    Why: Explicitly handling the error from url.Parse improves robustness and prevents silent failures, but since the input is a hardcoded string, the risk is low; still, this is a good defensive coding practice.

    Medium

    @dbarrosop dbarrosop requested a review from Copilot July 1, 2025 12:11
    Copy link
    Copy Markdown

    Copilot AI left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Pull Request Overview

    This PR enhances Docker host support by allowing non-unix endpoints while refactoring the Docker host parsing logic and updating related Traefik configurations. It also bumps the auth version in the example nhost configuration file.

    • Support for non-unix Docker endpoints in getDockerHost() and traefik service.
    • Dynamic setting of Docker endpoint and volumes based on the URL scheme.
    • Update of auth.version in examples/myproject/nhost/nhost.toml.

    Reviewed Changes

    Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

    File Description
    examples/myproject/nhost/nhost.toml Bumped auth.version from 0.37.1 to 0.40.0
    dockercompose/compose.go Refactored getDockerHost() to return *url.URL and updated traefik service configuration for non-unix endpoints
    Comments suppressed due to low confidence (1)

    dockercompose/compose.go:224

    • [nitpick] The function name 'trafikFiles' appears inconsistent with 'traefik' used elsewhere; consider renaming it to 'traefikFiles' for clarity and further consistency.
    	if err := trafikFiles(dotnhostfolder); err != nil {
    

    @dbarrosop dbarrosop merged commit db846ce into main Jul 1, 2025
    10 checks passed
    @dbarrosop dbarrosop deleted the docker-host branch July 1, 2025 12:33
    Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

    Labels

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    Support tcp scheme for DOCKER_HOST

    3 participants