mirror of
https://github.com/containers/podman.git
synced 2025-10-13 17:26:13 +08:00

The default policy file /etc/containers/policy.json location does not work on windows and for packages that ship a default. Now we search for the policy.json in the following overwrite locations: macos and linux: - ~/.config/containers/policy.json - /etc/containers/policy.json windows: - %APPDATA%\containers\policy.json Also it offers an additional DefaultPolicyJSONPath var that should be overwritten at built time with the path of the file that is shipped by packagers. Thile file is used when none of the overwrite paths exist. [NO NEW TESTS NEEDED] Signed-off-by: Paul Holzinger <pholzing@redhat.com>
20 lines
407 B
Go
20 lines
407 B
Go
//go:build !windows
|
|
|
|
package ocipull
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"github.com/containers/common/pkg/config"
|
|
"github.com/containers/storage/pkg/homedir"
|
|
)
|
|
|
|
func localPolicyOverwrites() []string {
|
|
var dirs []string
|
|
if p, err := homedir.GetConfigHome(); err == nil {
|
|
dirs = append(dirs, filepath.Join(p, "containers", policyfile))
|
|
}
|
|
dirs = append(dirs, config.DefaultSignaturePolicyPath)
|
|
return dirs
|
|
}
|