Change the default secret mode to match the default one used in
`service` subcommands.
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
| ... | ... |
@@ -217,19 +217,27 @@ func convertServiceSecrets( |
| 217 | 217 |
if gid == "" {
|
| 218 | 218 |
gid = "0" |
| 219 | 219 |
} |
| 220 |
+ mode := secret.Mode |
|
| 221 |
+ if mode == nil {
|
|
| 222 |
+ mode = uint32Ptr(0444) |
|
| 223 |
+ } |
|
| 220 | 224 |
|
| 221 | 225 |
opts = append(opts, &types.SecretRequestOption{
|
| 222 | 226 |
Source: source, |
| 223 | 227 |
Target: target, |
| 224 | 228 |
UID: uid, |
| 225 | 229 |
GID: gid, |
| 226 |
- Mode: os.FileMode(secret.Mode), |
|
| 230 |
+ Mode: os.FileMode(*mode), |
|
| 227 | 231 |
}) |
| 228 | 232 |
} |
| 229 | 233 |
|
| 230 | 234 |
return servicecli.ParseSecrets(client, opts) |
| 231 | 235 |
} |
| 232 | 236 |
|
| 237 |
+func uint32Ptr(value uint32) *uint32 {
|
|
| 238 |
+ return &value |
|
| 239 |
+} |
|
| 240 |
+ |
|
| 233 | 241 |
func convertExtraHosts(extraHosts map[string]string) []string {
|
| 234 | 242 |
hosts := []string{}
|
| 235 | 243 |
for host, ip := range extraHosts {
|