fix(core): update
This commit is contained in:
parent
224004217c
commit
cbdbd32dd1
@ -8,7 +8,7 @@ import * as docker from '../ts/index.js';
|
||||
let testDockerHost: docker.DockerHost;
|
||||
|
||||
tap.test('should create a new Dockersock instance', async () => {
|
||||
testDockerHost = new docker.DockerHost();
|
||||
testDockerHost = new docker.DockerHost({});
|
||||
return expect(testDockerHost).toBeInstanceOf(docker.DockerHost);
|
||||
});
|
||||
|
||||
@ -118,7 +118,7 @@ tap.test('should create a service', async () => {
|
||||
await testSecret.remove();
|
||||
});
|
||||
|
||||
tap.skip.test('should export images', async (toolsArg) => {
|
||||
tap.test('should export images', async (toolsArg) => {
|
||||
const done = toolsArg.defer();
|
||||
const testImage = await docker.DockerImage.createFromRegistry(testDockerHost, {
|
||||
creationObject: {
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@apiclient.xyz/docker',
|
||||
version: '1.1.0',
|
||||
version: '1.1.1',
|
||||
description: 'Provides easy communication with Docker remote API from Node.js, with TypeScript support.'
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import { DockerNetwork } from './classes.network.js';
|
||||
import { DockerService } from './classes.service.js';
|
||||
import { logger } from './logging.js';
|
||||
import path from 'path';
|
||||
import type { DockerImageStore } from './classes.imagestore.js';
|
||||
|
||||
export interface IAuthData {
|
||||
serveraddress: string;
|
||||
@ -11,21 +12,27 @@ export interface IAuthData {
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface IDockerHostConstructorOptions {
|
||||
dockerSockPath?: string;
|
||||
imageStoreDir?: string;
|
||||
}
|
||||
|
||||
export class DockerHost {
|
||||
/**
|
||||
* the path where the docker sock can be found
|
||||
*/
|
||||
public socketPath: string;
|
||||
private registryToken: string = '';
|
||||
public imageStore: DockerImageStore;
|
||||
|
||||
/**
|
||||
* the constructor to instantiate a new docker sock instance
|
||||
* @param pathArg
|
||||
*/
|
||||
constructor(pathArg?: string) {
|
||||
constructor(optionsArg: IDockerHostConstructorOptions) {
|
||||
let pathToUse: string;
|
||||
if (pathArg) {
|
||||
pathToUse = pathArg;
|
||||
if (optionsArg.dockerSockPath) {
|
||||
pathToUse = optionsArg.dockerSockPath;
|
||||
} else if (process.env.DOCKER_HOST) {
|
||||
pathToUse = process.env.DOCKER_HOST;
|
||||
} else if (process.env.CI) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import * as paths from './paths.js';
|
||||
import type { DockerHost } from './classes.host.js';
|
||||
|
||||
export interface IDockerImageStoreConstructorOptions {
|
||||
dirPath: string;
|
||||
@ -8,7 +9,7 @@ export interface IDockerImageStoreConstructorOptions {
|
||||
export class DockerImageStore {
|
||||
public options: IDockerImageStoreConstructorOptions;
|
||||
|
||||
constructor(optionsArg: IDockerImageStoreConstructorOptions) {
|
||||
constructor(dockerHost: DockerHost, optionsArg: IDockerImageStoreConstructorOptions) {
|
||||
this.options = optionsArg;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user