1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #30407 from thaJeztah/add-src-alias-for-secrets

Add "src" alias for `--secret`
This commit is contained in:
Victor Vieux 2017-01-26 10:53:27 -08:00 committed by GitHub
commit ab75ce6b66
2 changed files with 13 additions and 1 deletions

View file

@ -50,7 +50,7 @@ func (o *SecretOpt) Set(value string) error {
value := parts[1] value := parts[1]
switch key { switch key {
case "source": case "source", "src":
options.Source = value options.Source = value
case "target": case "target":
tDir, _ := filepath.Split(value) tDir, _ := filepath.Split(value)

View file

@ -35,6 +35,18 @@ func TestSecretOptionsSourceTarget(t *testing.T) {
assert.Equal(t, req.Target, "testing") assert.Equal(t, req.Target, "testing")
} }
func TestSecretOptionsShorthand(t *testing.T) {
var opt SecretOpt
testCase := "src=foo,target=testing"
assert.NilError(t, opt.Set(testCase))
reqs := opt.Value()
assert.Equal(t, len(reqs), 1)
req := reqs[0]
assert.Equal(t, req.Source, "foo")
}
func TestSecretOptionsCustomUidGid(t *testing.T) { func TestSecretOptionsCustomUidGid(t *testing.T) {
var opt SecretOpt var opt SecretOpt