Set 0444 as default secret mode in stack deploy

Change the default secret mode to match the default one used in
`service` subcommands.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2017-02-14 15:12:03 +01:00
parent 6cae9ce20b
commit 645f6ba7f5
2 changed files with 10 additions and 2 deletions

View File

@ -217,19 +217,27 @@ func convertServiceSecrets(
if gid == "" { if gid == "" {
gid = "0" gid = "0"
} }
mode := secret.Mode
if mode == nil {
mode = uint32Ptr(0444)
}
opts = append(opts, &types.SecretRequestOption{ opts = append(opts, &types.SecretRequestOption{
Source: source, Source: source,
Target: target, Target: target,
UID: uid, UID: uid,
GID: gid, GID: gid,
Mode: os.FileMode(secret.Mode), Mode: os.FileMode(*mode),
}) })
} }
return servicecli.ParseSecrets(client, opts) return servicecli.ParseSecrets(client, opts)
} }
func uint32Ptr(value uint32) *uint32 {
return &value
}
func convertExtraHosts(extraHosts map[string]string) []string { func convertExtraHosts(extraHosts map[string]string) []string {
hosts := []string{} hosts := []string{}
for host, ip := range extraHosts { for host, ip := range extraHosts {

View File

@ -229,7 +229,7 @@ type ServiceSecretConfig struct {
Target string Target string
UID string UID string
GID string GID string
Mode uint32 Mode *uint32
} }
// UlimitsConfig the ulimit configuration // UlimitsConfig the ulimit configuration