Skip to content

Support for http mode #1187

@DylanBergmann2502

Description

@DylanBergmann2502

Netclient hard codes "https://" for all api calls. That default is very good in production environment but we embed netclient as a part of our toolings and for local development, we have to patch the netclient itself like this for all services that use it:

# Build netclient with HTTP patches (for local development)
FROM golang:1.25-alpine AS netclient-builder

# Define version inside the build stage
ARG NETCLIENT_VERSION=v1.4.0

# Install git
RUN apk add --no-cache git

# Clone the netclient repository and checkout specific version
WORKDIR /build
RUN git clone https://github.com/gravitl/netclient.git . && \
    git checkout ${NETCLIENT_VERSION}

# Patch ONLY API-related https:// to http:// (surgical patches for local dev)
# Using find to apply patches to all relevant files
RUN find . -type f -name '*.go' -exec sed -i \
    -e 's|"https://" + server\.API|"http://" + server.API|g' \
    -e 's|"https://" + serverData\.Server|"http://" + serverData.Server|g' \
    -e 's|"https://" + api|"http://" + api|g' \
    -e 's|fmt\.Sprintf("https://%s/|fmt.Sprintf("http://%s/|g' \
    {} \;

# Build the patched netclient
RUN go mod download && \
    CGO_ENABLED=0 GOOS=linux go build -o netclient .

Not sure why netmaker team doesn't support http at least by an env/flag or something. I guess you guys have your own reasons. But We would love to actually have the official support from you guys instead of having to do it like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions