fix(core): update
This commit is contained in:
@ -1,2 +1 @@
|
||||
import * as plugins from './dockersock.plugins';
|
||||
|
||||
|
@ -3,8 +3,11 @@ import { DockerHost } from './docker.classes.host';
|
||||
|
||||
export class DockerContainer {
|
||||
static async getContainers(dockerHostArg: DockerHost): Promise<DockerContainer[]> {
|
||||
const result = [];
|
||||
await dockerHostArg.request('GET', '/containers/json')
|
||||
const result: DockerContainer[] = [];
|
||||
const response = await dockerHostArg.request('GET', '/containers/json');
|
||||
for(const containerResult in response.body) {
|
||||
result.push(new DockerContainer());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as plugins from "./dockersock.plugins";
|
||||
import { DockerContainer } from "./docker.classes.container";
|
||||
import * as plugins from './dockersock.plugins';
|
||||
import { DockerContainer } from './docker.classes.container';
|
||||
|
||||
export class DockerHost {
|
||||
/**
|
||||
@ -16,7 +16,7 @@ export class DockerHost {
|
||||
* the constructor to instantiate a new docker sock instance
|
||||
* @param pathArg
|
||||
*/
|
||||
constructor(pathArg: string = "http://unix:/var/run/docker.sock:") {
|
||||
constructor(pathArg: string = 'http://unix:/var/run/docker.sock:') {
|
||||
this.sockPath = pathArg;
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ export class DockerHost {
|
||||
*/
|
||||
auth(registryArg: string, userArg: string, passArg: string) {
|
||||
let done = plugins.smartpromise.defer();
|
||||
this.request("POST", "");
|
||||
this.request('POST', '');
|
||||
return done.promise;
|
||||
}
|
||||
|
||||
@ -43,16 +43,16 @@ export class DockerHost {
|
||||
* fire a request
|
||||
*/
|
||||
async request(methodArg: string, routeArg: string, dataArg = {}) {
|
||||
const requestUrl = `${this.sockPath}${routeArg}`
|
||||
const requestUrl = `${this.sockPath}${routeArg}`;
|
||||
console.log(requestUrl);
|
||||
const response = await plugins.smartrequest.request(requestUrl, {
|
||||
method: methodArg,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Host": "docker.sock"
|
||||
'Content-Type': 'application/json',
|
||||
Host: 'docker.sock'
|
||||
},
|
||||
requestBody: dataArg
|
||||
});
|
||||
return response
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
@ -11,4 +11,4 @@ export class DockerImage {
|
||||
const resultingImage = new DockerImage();
|
||||
return resultingImage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user