Add ability to overrider depending containers with special label (#489)

* Add ability to overrider depending containers with special label

* Add documentation of how to override container dependencies with special label
This commit is contained in:
Valentine Zavadsky 2020-04-24 14:41:04 +03:00 committed by GitHub
parent 7b0d311799
commit b32cb5d35d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 64 additions and 1 deletions

View file

@ -95,6 +95,13 @@ func (c Container) Enabled() (bool, bool) {
func (c Container) Links() []string {
var links []string
dependsOnLabelValue := c.getLabelValueOrEmpty(dependsOnLabel)
if dependsOnLabelValue != "" {
links := strings.Split(dependsOnLabelValue, ",")
return links
}
if (c.containerInfo != nil) && (c.containerInfo.HostConfig != nil) {
for _, link := range c.containerInfo.HostConfig.Links {
name := strings.Split(link, ":")[0]