the-moby-effect
Version:
Moby/Docker API client built using effect-ts
136 lines (134 loc) • 6.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.connectionOptionsFromUserSocketDefault = exports.connectionOptionsFromUrl = exports.connectionOptionsFromPlatformSystemSocketDefault = exports.connectionOptionsFromDockerHostEnvironmentVariable = exports.SshConnectionOptions = exports.SocketConnectionOptions = exports.MobyConnectionOptions = exports.HttpsConnectionOptions = exports.HttpConnectionOptions = void 0;
var internal = _interopRequireWildcard(require("./internal/platforms/connection.js"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
/**
* Http, https, ssh, and unix socket connection agents for all platforms.
*
* @since 1.0.0
*/
/**
* Connection options for how to connect to your moby/docker instance. Can be a
* unix socket on the current machine. Can be an ssh connection to a remote
* machine with a remote user, remote machine, remote port, and remote socket
* path. Can be an http connection to a remote machine with a host, port, and
* path. Or it can be an https connection to a remote machine with a host, port,
* path, cert, ca, key, and passphrase.
*
* @since 1.0.0
* @category Connection Types
*/
const MobyConnectionOptions = exports.MobyConnectionOptions = internal.MobyConnectionOptions;
/**
* @since 1.0.0
* @category Connection Constructors
* @example
* import { SocketConnectionOptions } from "the-moby-effect/MobyConnection";
* const connectionOptions = SocketConnectionOptions({
* socketPath: "/var/run/docker.sock",
* });
*/
const SocketConnectionOptions = exports.SocketConnectionOptions = internal.SocketConnectionOptions;
/**
* Connects to a remote machine over ssh. This specific ssh implementation uses
* the OpenSSH extension "ForwardOutLocalStream" (so you must being running an
* OpenSSH server or something that implements the "ForwardOutLocalStream"
* extension) that opens a connection to a UNIX domain socket at socketPath on
* the server.
*
* @since 1.0.0
* @category Connection Constructors
* @example
* import { SshConnectionOptions } from "the-moby-effect/MobyConnection";
* const connectionOptions = SshConnectionOptions({
* host: "host.domain.com",
* port: 2222,
* username: "user",
* password: "password",
* remoteSocketPath: "/var/run/docker.sock",
* });
*/
const SshConnectionOptions = exports.SshConnectionOptions = internal.SshConnectionOptions;
/**
* @since 1.0.0
* @category Connection Constructors
* @example
* import { HttpConnectionOptions } from "the-moby-effect/MobyConnection";
* const connectionOptions = HttpConnectionOptions({
* host: "host.domain.com",
* port: 2375,
* path: "/proxy-path",
* });
*/
const HttpConnectionOptions = exports.HttpConnectionOptions = internal.HttpConnectionOptions;
/**
* @since 1.0.0
* @category Connection Constructors
* @example
* import { HttpsConnectionOptions } from "the-moby-effect/MobyConnection";
* const connectionOptions = HttpsConnectionOptions({
* host: "host.domain.com",
* port: 2375,
* path: "/proxy-path",
* // passphrase: "password",
* // ca: fs.readFileSync("ca.pem"),
* // key: fs.readFileSync("key.pem"),
* // cert: fs.readFileSync("cert.pem"),
* });
*/
const HttpsConnectionOptions = exports.HttpsConnectionOptions = internal.HttpsConnectionOptions;
/**
* From
* https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-socket-option
*
* "The Docker client will honor the DOCKER_HOST environment variable to set the
* -H flag for the client"
*
* And then from
* https://docs.docker.com/engine/reference/commandline/dockerd/#bind-docker-to-another-hostport-or-a-unix-socket
*
* "-H accepts host and port assignment in the following format:
* `tcp://[host]:[port][path]` or `unix://path`
*
* For example:
*
* - `unix://path/to/socket` -> Unix socket located at path/to/socket
* - When -H is empty, it will default to the same value as when no -H was passed
* in
* - `http://host:port/path` -> HTTP connection on host:port and prepend path to
* all requests
* - `https://host:port/path` -> HTTPS connection on host:port and prepend path to
* all requests
* - `ssh://me@example.com:22/var/run/docker.sock` -> SSH connection to
* example.com on port 22
*
* @since 1.0.0
* @category Constructors
*/
const connectionOptionsFromUrl = exports.connectionOptionsFromUrl = internal.connectionOptionsFromUrl;
/**
* Creates a MobyApi layer from the DOCKER_HOST environment variable as a url.
*
* @since 1.0.0
* @category Constructors
*/
const connectionOptionsFromDockerHostEnvironmentVariable = exports.connectionOptionsFromDockerHostEnvironmentVariable = internal.connectionOptionsFromDockerHostEnvironmentVariable;
/**
* Creates a MobyApi layer from the platform default system socket location.
*
* @since 1.0.0
* @category Constructors
*/
const connectionOptionsFromPlatformSystemSocketDefault = exports.connectionOptionsFromPlatformSystemSocketDefault = internal.connectionOptionsFromPlatformSystemSocketDefault;
/**
* Creates a MobyApi layer from the platform default system socket location.
*
* @since 1.0.0
* @category Constructors
*/
const connectionOptionsFromUserSocketDefault = exports.connectionOptionsFromUserSocketDefault = internal.connectionOptionsFromUserSocketDefault;
//# sourceMappingURL=MobyConnection.js.map