diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-01-18 15:57:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-18 15:57:30 +0100 |
commit | 7f19e5fb23b785399d49166171b6af7a34edf437 (patch) | |
tree | a051df01eed537fed2b4dbd7963266153cbf4bfc /libpod | |
parent | e3dc6609d05695e649e76d4505e4761cafebcef6 (diff) | |
parent | c90e3e7fe59db0bfbce0c10bba8a9ff71c7c7266 (diff) | |
download | podman-7f19e5fb23b785399d49166171b6af7a34edf437.tar.gz podman-7f19e5fb23b785399d49166171b6af7a34edf437.tar.bz2 podman-7f19e5fb23b785399d49166171b6af7a34edf437.zip |
Merge pull request #2149 from afbjorklund/bridge
Add bridge support, for the varlink connection
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/adapter/client.go | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/libpod/adapter/client.go b/libpod/adapter/client.go index 383c242c9..b3bb9acae 100644 --- a/libpod/adapter/client.go +++ b/libpod/adapter/client.go @@ -3,12 +3,32 @@ package adapter import ( + "os" + + "github.com/sirupsen/logrus" "github.com/varlink/go/varlink" ) +// DefaultAddress is the default address of the varlink socket +const DefaultAddress = "unix:/run/podman/io.podman" + // Connect provides a varlink connection func (r RemoteRuntime) Connect() (*varlink.Connection, error) { - connection, err := varlink.NewConnection("unix:/run/podman/io.podman") + var err error + var connection *varlink.Connection + if bridge := os.Getenv("PODMAN_VARLINK_BRIDGE"); bridge != "" { + logrus.Infof("Connecting with varlink bridge") + logrus.Debugf("%s", bridge) + connection, err = varlink.NewBridge(bridge) + } else { + address := os.Getenv("PODMAN_VARLINK_ADDRESS") + if address == "" { + address = DefaultAddress + } + logrus.Infof("Connecting with varlink address") + logrus.Debugf("%s", address) + connection, err = varlink.NewConnection(address) + } if err != nil { return nil, err } |