1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
Commit graph

10 commits

Author SHA1 Message Date
Sebastiaan van Stijn
5979d6e7e3
client: add const for environment variables, and document them
This adds consts for the environment variables that are supported
by the client. These environment variables are unlikely to change,
or at least, unlikely to be removed, but having consts allows for
them to be documented.

I did not change all occurrences of these variables to use the const,
as they're used in various tests, and it's ok to use a fixture for
those, but it's nice to have a const available for (external) consumers
of the client package, and to have their purpose (and caveats)
documented in the code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-07 12:35:55 +01:00
Sebastiaan van Stijn
c2c7e9d449
client: improve GoDoc, and minor touch-ups
- Improve documentation of various functions to better describe their behavior.
- Rename some variables to be more descriptive (as this is client code, used
  by external consumers, it's nice to be a bit more explicit).
- Remove a redundant check in `WithVersionFromEnv()`, as `WithVersion()`
  already checks for empty values.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-07 12:35:38 +01:00
Sebastiaan van Stijn
eae20b1a1b
client: extract FromEnv parts to separate WithXX options
Implements three options;

- WithTLSClientConfigFromEnv()
- WithHostFromEnv()
- WithVersionFromEnv()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-10 17:15:40 +01:00
Sebastiaan van Stijn
28d7dba41d
Merge pull request #39032 from thaJeztah/improve_version_negotiation
Add client.WithAPIVersionNegotiation() option
2019-04-20 13:34:22 +02:00
Sebastiaan van Stijn
44982c775e
Add client.WithTimeout() option
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-11 13:35:48 +02:00
Sebastiaan van Stijn
b26aa97914
Add client.WithAPIVersionNegotiation() option
WithAPIVersionNegotiation enables automatic API version negotiation for the client.

With this option enabled, the client automatically negotiates the API version
to use when making requests. API version negotiation is performed on the first
request; subsequent requests will not re-negotiate.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-10 19:23:47 +02:00
Sebastiaan van Stijn
0041e2419a
Fix empty WithVersion blocking version negotiation
commit 3d72963ab8 fixed
situations where a version negotiation could override
the version, even though a client was initialized with a
fixed version.

In situations where the "fixed" version is empty, we
should ignore the option, and treat the client as
"not having a fixed version", so that API version
negotiation can still be performed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-10 11:14:37 +02:00
Sebastiaan van Stijn
e6c0d19c3a
client: define "Opt" type
Minor improvement, but makes defining a list of options
a bit cleaner, and more descriptive;

Before:

    opts := make([]func(*client.Client) error, 0)

After:

    opts := make([]client.Opt, 0)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-10 01:23:45 +02:00
Sebastiaan van Stijn
3d72963ab8
Fix client version not being pinned when set
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-20 10:46:36 +01:00
Sebastiaan van Stijn
01eb35bfb3
Move client-opts to a separate file
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-21 14:52:46 +01:00