(container: DockerContainer)
| 2 | import { Network } from "./Network"; |
| 3 | |
| 4 | export const Container = (container: DockerContainer) => { |
| 5 | return { |
| 6 | ...container, |
| 7 | |
| 8 | get stack(): string { |
| 9 | return this.Labels["com.docker.compose.project"]; |
| 10 | }, |
| 11 | |
| 12 | get name(): string { |
| 13 | return ( |
| 14 | this.Labels["stack.name"] || |
| 15 | this.Labels["dash.name"] || |
| 16 | this.Names[0].replace(new RegExp(`^/${this.stack}-`), "") |
| 17 | ); |
| 18 | }, |
| 19 | |
| 20 | get desc(): string | undefined { |
| 21 | return this.Labels["stack.desc"] || this.Labels["dash.desc"] || undefined; |
| 22 | }, |
| 23 | |
| 24 | get belongsToNetworks() { |
| 25 | return (networks?: Network[]) => |
| 26 | Object.keys(this.NetworkSettings.Networks).every((networkName) => |
| 27 | networks?.some((network) => network.Name === networkName) |
| 28 | ); |
| 29 | }, |
| 30 | }; |
| 31 | }; |
| 32 | |
| 33 | export type Container = ReturnType<typeof Container>; |
| 34 |
nothing calls this directly
no outgoing calls
no test coverage detected