fix(core): update
This commit is contained in:
		| @@ -4,7 +4,7 @@ import * as docker from '../ts/index.js'; | |||||||
| let testDockerHost: docker.DockerHost; | let testDockerHost: docker.DockerHost; | ||||||
|  |  | ||||||
| tap.test('should create a new Dockersock instance', async () => { | tap.test('should create a new Dockersock instance', async () => { | ||||||
|   testDockerHost = new docker.DockerHost('http://unix:/var/run/docker.sock:'); |   testDockerHost = new docker.DockerHost(); | ||||||
|   return expect(testDockerHost).toBeInstanceOf(docker.DockerHost); |   return expect(testDockerHost).toBeInstanceOf(docker.DockerHost); | ||||||
| }); | }); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,6 +3,6 @@ | |||||||
|  */ |  */ | ||||||
| export const commitinfo = { | export const commitinfo = { | ||||||
|   name: '@apiclient.xyz/docker', |   name: '@apiclient.xyz/docker', | ||||||
|   version: '1.0.106', |   version: '1.0.107', | ||||||
|   description: 'easy communication with docker remote api from node, TypeScript ready' |   description: 'easy communication with docker remote api from node, TypeScript ready' | ||||||
| } | } | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ import { DockerContainer } from './docker.classes.container.js'; | |||||||
| import { DockerNetwork } from './docker.classes.network.js'; | import { DockerNetwork } from './docker.classes.network.js'; | ||||||
| import { DockerService } from './docker.classes.service.js'; | import { DockerService } from './docker.classes.service.js'; | ||||||
| import { logger } from './docker.logging.js'; | import { logger } from './docker.logging.js'; | ||||||
|  | import path from 'path'; | ||||||
|  |  | ||||||
| export interface IAuthData { | export interface IAuthData { | ||||||
|   serveraddress: string; |   serveraddress: string; | ||||||
| @@ -25,11 +26,17 @@ export class DockerHost { | |||||||
|     let pathToUse: string; |     let pathToUse: string; | ||||||
|     if (pathArg) { |     if (pathArg) { | ||||||
|       pathToUse = pathArg; |       pathToUse = pathArg; | ||||||
|  |     } else if (process.env.DOCKER_HOST) { | ||||||
|  |       pathToUse = process.env.DOCKER_HOST; | ||||||
|     } else if (process.env.CI) { |     } else if (process.env.CI) { | ||||||
|       pathToUse = 'http://docker:2375/'; |       pathToUse = 'http://docker:2375/'; | ||||||
|     } else { |     } else { | ||||||
|       pathToUse = 'http://unix:/var/run/docker.sock:'; |       pathToUse = 'http://unix:/var/run/docker.sock:'; | ||||||
|     } |     } | ||||||
|  |     if (pathToUse.startsWith('unix:///')) { | ||||||
|  |       pathToUse = pathToUse.replace('unix://', 'http://unix:') + ':'; | ||||||
|  |     } | ||||||
|  |     console.log(`using docker sock at ${pathToUse}`); | ||||||
|     this.socketPath = pathToUse; |     this.socketPath = pathToUse; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user