mirror of
https://github.com/thegeeklab/drone-yaml.git
synced 2024-11-22 10:00:39 +00:00
Merge pull request #39 from tboerger/add-marshaller
Add yaml marshalling for variable and parameter
This commit is contained in:
commit
5b0d86fdd6
13
yaml/env.go
13
yaml/env.go
@ -42,3 +42,16 @@ func (v *Variable) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||||||
v.Secret = d.Secret
|
v.Secret = d.Secret
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalYAML implements yaml marshalling.
|
||||||
|
func (v *Variable) MarshalYAML() (interface{}, error) {
|
||||||
|
if v.Secret != "" {
|
||||||
|
m := map[string]interface{}{}
|
||||||
|
m["from_secret"] = v.Secret
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
if v.Value != "" {
|
||||||
|
return v.Value, nil
|
||||||
|
}
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
@ -43,3 +43,16 @@ func (p *Parameter) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||||||
p.Value = i
|
p.Value = i
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalYAML implements yaml marshalling.
|
||||||
|
func (p *Parameter) MarshalYAML() (interface{}, error) {
|
||||||
|
if p.Secret != "" {
|
||||||
|
m := map[string]interface{}{}
|
||||||
|
m["from_secret"] = p.Secret
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
if p.Value != "" {
|
||||||
|
return p.Value, nil
|
||||||
|
}
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user