Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a61a88c

Browse files
committed
Normalize configuration for PHP versions
1 parent 8e49c97 commit a61a88c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

configuration/configuration.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ func (c *Configuration) OnlyRunExtraAnsiblePlaybooks() bool {
145145
return c.onlyRunExtraAnsiblePlaybooks
146146
}
147147

148+
func (c *Configuration) Normalize() {
149+
phpVersions := make([]string, 0)
150+
for _, version := range c.PHP.Versions {
151+
if version != c.PHP.DefaultVersion {
152+
phpVersions = append(phpVersions, version)
153+
}
154+
}
155+
phpVersions = append(phpVersions, c.PHP.DefaultVersion)
156+
c.PHP.Versions = phpVersions
157+
}
158+
148159
// Load loads configuration from config.json file.
149160
func Load() (c *Configuration, err error) {
150161
var content []byte
@@ -165,6 +176,8 @@ func Load() (c *Configuration, err error) {
165176
}
166177
}
167178

179+
c.Normalize()
180+
168181
if content, err = json.MarshalIndent(c, "", " "); nil != err {
169182
return nil, err
170183
}

0 commit comments

Comments
 (0)