Skip to content

Commit

Permalink
append default domain if not append
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek9686 committed Dec 12, 2024
1 parent c3f2c50 commit 104af4c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion controllers/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"net/http"
"strings"

"github.com/gorilla/mux"
"github.com/gravitl/netmaker/database"
Expand Down Expand Up @@ -162,7 +163,10 @@ func createDNS(w http.ResponseWriter, r *http.Request) {
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "badrequest"))
return
}

// check if default domain is appended if not append
if !strings.HasSuffix(entry.Name, servercfg.GetDefaultDomain()) {
entry.Name += servercfg.GetDefaultDomain()
}
entry, err = logic.CreateDNS(entry)
if err != nil {
logger.Log(0, r.Header.Get("user"),
Expand Down

0 comments on commit 104af4c

Please sign in to comment.