summaryrefslogtreecommitdiff
path: root/cmd/podman/registry/remote.go
blob: 7dbdd3824764b03485deccddba72a9cdf2eafec4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package registry

import (
	"os"
	"sync"

	"github.com/containers/podman/v2/pkg/domain/entities"
	"github.com/spf13/cobra"
)

var (
	// Was --remote given on command line
	remoteOverride bool
	remoteSync     sync.Once
)

// IsRemote returns true if podman was built to run remote
// Use in init() functions as a initialization check
func IsRemote() bool {
	remoteSync.Do(func() {
		remote := &cobra.Command{}
		remote.Flags().BoolVarP(&remoteOverride, "remote", "r", false, "")
		_ = remote.ParseFlags(os.Args)
	})
	return podmanOptions.EngineMode == entities.TunnelMode || remoteOverride
}