@wocker/core 1.0.17-dev.3 → 1.0.17-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/makes/Project.d.ts +3 -0
- package/lib/makes/Project.js +17 -0
- package/package.json +1 -1
package/lib/makes/Project.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare abstract class Project {
|
|
|
15
15
|
env?: EnvConfig;
|
|
16
16
|
ports?: string[];
|
|
17
17
|
volumes?: string[];
|
|
18
|
+
extraHosts?: EnvConfig;
|
|
18
19
|
metadata?: EnvConfig;
|
|
19
20
|
protected constructor(data: ProjectProperties);
|
|
20
21
|
get containerName(): string;
|
|
@@ -37,6 +38,8 @@ export declare abstract class Project {
|
|
|
37
38
|
getVolumeByDestination(destination: string): string | undefined;
|
|
38
39
|
volumeMount(...volumes: string[]): void;
|
|
39
40
|
volumeUnmount(...volumes: string[]): void;
|
|
41
|
+
addExtraHost(host: string, domain: string): void;
|
|
42
|
+
removeExtraHost(host: string): void;
|
|
40
43
|
abstract save(): Promise<void>;
|
|
41
44
|
toJSON(): ProjectProperties;
|
|
42
45
|
}
|
package/lib/makes/Project.js
CHANGED
|
@@ -17,6 +17,7 @@ class Project {
|
|
|
17
17
|
this.env = data.env;
|
|
18
18
|
this.ports = data.ports;
|
|
19
19
|
this.volumes = data.volumes;
|
|
20
|
+
this.extraHosts = data.extraHosts;
|
|
20
21
|
this.metadata = data.metadata;
|
|
21
22
|
Object.assign(this, data);
|
|
22
23
|
}
|
|
@@ -171,6 +172,21 @@ class Project {
|
|
|
171
172
|
}
|
|
172
173
|
this.volumeUnmount(...restVolumes);
|
|
173
174
|
}
|
|
175
|
+
addExtraHost(host, domain) {
|
|
176
|
+
if (!this.extraHosts) {
|
|
177
|
+
this.extraHosts = {};
|
|
178
|
+
}
|
|
179
|
+
this.extraHosts[host] = domain;
|
|
180
|
+
}
|
|
181
|
+
removeExtraHost(host) {
|
|
182
|
+
if (!this.extraHosts || !this.extraHosts[host]) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
delete this.extraHosts[host];
|
|
186
|
+
if (Object.keys(this.extraHosts).length === 0) {
|
|
187
|
+
delete this.extraHosts;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
174
190
|
toJSON() {
|
|
175
191
|
return {
|
|
176
192
|
id: this.id,
|
|
@@ -186,6 +202,7 @@ class Project {
|
|
|
186
202
|
env: this.env,
|
|
187
203
|
ports: this.ports,
|
|
188
204
|
volumes: this.volumes,
|
|
205
|
+
extraHosts: this.extraHosts,
|
|
189
206
|
metadata: this.metadata
|
|
190
207
|
};
|
|
191
208
|
}
|