summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorCory Snider <csnider@mirantis.com>2022-08-17 16:46:26 -0400
committerCory Snider <csnider@mirantis.com>2023-02-28 13:49:53 -0500
commit0a6a726d267e663d4003435c62ed9475e541cd5c (patch)
treefe84edfaa615c9f279b4c1a96d50d6ba4b543ed8 /api
parent0021339b9299c5f1596bdf772a42ce346f16f060 (diff)
downloaddocker-0a6a726d267e663d4003435c62ed9475e541cd5c.tar.gz
api/server: drop unused Config struct
The Server.cfg field is never referenced by any code in package "./api/server". "./api/server".Config struct values are used by DaemonCli code, but only to pass around configuration copied out of the daemon config within the "./cmd/dockerd" package. Delete the "./api/server".Config struct definition and refactor the "./cmd/dockerd" package to pull configuration directly from cli.Config. Signed-off-by: Cory Snider <csnider@mirantis.com>
Diffstat (limited to 'api')
-rw-r--r--api/server/server.go20
-rw-r--r--api/server/server_test.go7
2 files changed, 1 insertions, 26 deletions
diff --git a/api/server/server.go b/api/server/server.go
index e8714eb060..3ce2659287 100644
--- a/api/server/server.go
+++ b/api/server/server.go
@@ -2,7 +2,6 @@ package server // import "github.com/docker/docker/api/server"
import (
"context"
- "crypto/tls"
"net"
"net/http"
"strings"
@@ -22,32 +21,13 @@ import (
// when a request is about to be served.
const versionMatcher = "/v{version:[0-9.]+}"
-// Config provides the configuration for the API server
-type Config struct {
- CorsHeaders string
- Version string
- SocketGroup string
- TLSConfig *tls.Config
- // Hosts is a list of addresses for the API to listen on.
- Hosts []string
-}
-
// Server contains instance details for the server
type Server struct {
- cfg *Config
servers []*HTTPServer
routers []router.Router
middlewares []middleware.Middleware
}
-// New returns a new instance of the server based on the specified configuration.
-// It allocates resources which will be needed for ServeAPI(ports, unix-sockets).
-func New(cfg *Config) *Server {
- return &Server{
- cfg: cfg,
- }
-}
-
// UseMiddleware appends a new middleware to the request chain.
// This needs to be called before the API routes are configured.
func (s *Server) UseMiddleware(m middleware.Middleware) {
diff --git a/api/server/server_test.go b/api/server/server_test.go
index a3e8124a88..8b71e9fce6 100644
--- a/api/server/server_test.go
+++ b/api/server/server_test.go
@@ -13,12 +13,7 @@ import (
)
func TestMiddlewares(t *testing.T) {
- cfg := &Config{
- Version: "0.1omega2",
- }
- srv := &Server{
- cfg: cfg,
- }
+ srv := &Server{}
srv.UseMiddleware(middleware.NewVersionMiddleware("0.1omega2", api.DefaultVersion, api.MinVersion))