mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
Merge pull request #19549 from LazarusX/fix_dockerode_type
Update Dockerode options types
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import * as Docker from 'dockerode';
|
||||
import * as fs from 'fs';
|
||||
|
||||
// Code samples from Dockerode 'Getting started'
|
||||
const docker = new Docker();
|
||||
@@ -25,6 +26,24 @@ const docker6 = new Docker({
|
||||
});
|
||||
|
||||
const docker7 = new Docker({
|
||||
host: '192.168.1.10',
|
||||
port: process.env.DOCKER_PORT || 2375,
|
||||
ca: fs.readFileSync('ca.pem'),
|
||||
cert: fs.readFileSync('cert.pem'),
|
||||
key: fs.readFileSync('key.pem'),
|
||||
version: 'v1.25' // required when Docker >= v1.13, https://docs.docker.com/engine/api/version-history/
|
||||
});
|
||||
|
||||
const docker8 = new Docker({
|
||||
protocol: 'https', // you can enforce a protocol
|
||||
host: '192.168.1.10',
|
||||
port: process.env.DOCKER_PORT || 2375,
|
||||
ca: fs.readFileSync('ca.pem'),
|
||||
cert: fs.readFileSync('cert.pem'),
|
||||
key: fs.readFileSync('key.pem')
|
||||
});
|
||||
|
||||
const docker9 = new Docker({
|
||||
Promise
|
||||
});
|
||||
|
||||
|
||||
15
types/dockerode/index.d.ts
vendored
15
types/dockerode/index.d.ts
vendored
@@ -1,8 +1,9 @@
|
||||
// Type definitions for dockerode 2.4
|
||||
// Type definitions for dockerode 2.5
|
||||
// Project: https://github.com/apocas/dockerode
|
||||
// Definitions by: Carl Winkler <https://github.com/seikho>
|
||||
// Nicolas Laplante <https://github.com/nlaplante>
|
||||
// ByeongHun Yoo <https://github.com/isac322>
|
||||
// Ray Fang <https://github.com/lazarusx>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -655,15 +656,21 @@ declare namespace Dockerode {
|
||||
};
|
||||
}
|
||||
|
||||
interface KeyObject {
|
||||
pem: string | Buffer;
|
||||
passphrase?: string;
|
||||
}
|
||||
|
||||
interface DockerOptions {
|
||||
socketPath?: string;
|
||||
host?: string;
|
||||
port?: number | string;
|
||||
ca?: string;
|
||||
cert?: string;
|
||||
key?: string;
|
||||
ca?: string | string[] | Buffer | Buffer[];
|
||||
cert?: string | string[] | Buffer | Buffer[];
|
||||
key?: string | string[] | Buffer | Buffer[] | KeyObject[];
|
||||
protocol?: "https" | "http";
|
||||
timeout?: number;
|
||||
version?: string;
|
||||
Promise?: typeof Promise;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user