本文整理匯總了Golang中github.com/eris-ltd/eris-cli/definitions.Service.Links方法的典型用法代碼示例。如果您正苦於以下問題:Golang Service.Links方法的具體用法?Golang Service.Links怎麽用?Golang Service.Links使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/eris-ltd/eris-cli/definitions.Service
的用法示例。
在下文中一共展示了Service.Links方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: connectToAService
// links and mounts for service dependencies
func connectToAService(srv *definitions.Service, ops *definitions.Operation, typ, name, internalName string, link, mount bool) {
log.WithFields(log.Fields{
"=>": srv.Name,
"type": typ,
"name": name,
"internal name": internalName,
"link": link,
"volumes from": mount,
}).Debug("Connecting to service")
containerName := util.ContainersName(typ, name, ops.ContainerNumber)
if link {
newLink := containerName + ":" + internalName
srv.Links = append(srv.Links, newLink)
}
if mount {
// Automagically mount VolumesFrom for serviceDeps so they can
// easily pass files back and forth. note that this is opinionated
// and will mount as read-write. we can revisit this if read-only
// mounting required for specific use cases
newVol := containerName + ":rw"
srv.VolumesFrom = append(srv.VolumesFrom, newVol)
}
}
示例2: connectToAService
// links and mounts for service dependencies
func connectToAService(srv *definitions.Service, ops *definitions.Operation, typ, name, internalName string, link, mount bool) {
logger.Debugf("Connecting service %s to %s %s (%s) with link (%v) and volumes-from (%v)\n", srv.Name, typ, name, internalName, link, mount)
containerName := util.ContainersName(typ, name, ops.ContainerNumber)
if link {
newLink := containerName + ":" + internalName
srv.Links = append(srv.Links, newLink)
}
if mount {
// Automagically mount VolumesFrom for serviceDeps so they can
// easily pass files back and forth. note that this is opinionated
// and will mount as read-write. we can revisit this if read-only
// mounting required for specific use cases
newVol := containerName + ":rw"
srv.VolumesFrom = append(srv.VolumesFrom, newVol)
}
}