summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-06-04 18:13:21 +0200
committerGitHub <noreply@github.com>2021-06-04 18:13:21 +0200
commitcdf26a3d5677e0372e8892f85a8fd6065d512bcf (patch)
treefd499393b681028d6bd44022513ecc70d953521d /cmd/podman
parentc361a3886e28eabbefe403323d4d65663f284ea5 (diff)
parent2810c478a7f2497fad1300ce63c8476bb50a6ad0 (diff)
downloadpodman-cdf26a3d5677e0372e8892f85a8fd6065d512bcf.tar.gz
podman-cdf26a3d5677e0372e8892f85a8fd6065d512bcf.tar.bz2
podman-cdf26a3d5677e0372e8892f85a8fd6065d512bcf.zip
Merge pull request #10546 from boaz0/closes_8645
Add CORS support
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/system/service.go11
-rw-r--r--cmd/podman/system/service_abi.go2
2 files changed, 8 insertions, 5 deletions
diff --git a/cmd/podman/system/service.go b/cmd/podman/system/service.go
index 63f2de51e..a30f43839 100644
--- a/cmd/podman/system/service.go
+++ b/cmd/podman/system/service.go
@@ -39,7 +39,8 @@ Enable a listening service for API access to Podman commands.
}
srvArgs = struct {
- Timeout int64
+ Timeout int64
+ CorsHeaders string
}{}
)
@@ -54,6 +55,8 @@ func init() {
timeFlagName := "time"
flags.Int64VarP(&srvArgs.Timeout, timeFlagName, "t", 5, "Time until the service session expires in seconds. Use 0 to disable the timeout")
_ = srvCmd.RegisterFlagCompletionFunc(timeFlagName, completion.AutocompleteNone)
+ flags.StringVarP(&srvArgs.CorsHeaders, "cors", "", "", "Set CORS Headers")
+ _ = srvCmd.RegisterFlagCompletionFunc("cors", completion.AutocompleteNone)
flags.SetNormalizeFunc(aliasTimeoutFlag)
}
@@ -71,7 +74,6 @@ func service(cmd *cobra.Command, args []string) error {
return err
}
logrus.Infof("using API endpoint: '%s'", apiURI)
-
// Clean up any old existing unix domain socket
if len(apiURI) > 0 {
uri, err := url.Parse(apiURI)
@@ -90,8 +92,9 @@ func service(cmd *cobra.Command, args []string) error {
}
opts := entities.ServiceOptions{
- URI: apiURI,
- Command: cmd,
+ URI: apiURI,
+ Command: cmd,
+ CorsHeaders: srvArgs.CorsHeaders,
}
opts.Timeout = time.Duration(srvArgs.Timeout) * time.Second
diff --git a/cmd/podman/system/service_abi.go b/cmd/podman/system/service_abi.go
index 364663323..d59a45564 100644
--- a/cmd/podman/system/service_abi.go
+++ b/cmd/podman/system/service_abi.go
@@ -72,7 +72,7 @@ func restService(opts entities.ServiceOptions, flags *pflag.FlagSet, cfg *entiti
}
infra.StartWatcher(rt)
- server, err := api.NewServerWithSettings(rt, opts.Timeout, listener)
+ server, err := api.NewServerWithSettings(rt, listener, api.Options{Timeout: opts.Timeout, CorsHeaders: opts.CorsHeaders})
if err != nil {
return err
}