Don't crash when passing in an environment variable that isn't a string value

This commit is contained in:
Dane Everitt
2020-07-02 20:32:17 -07:00
parent e5b844d2c4
commit 65809b5731
3 changed files with 37 additions and 36 deletions

View File

@@ -34,7 +34,7 @@ func New(data []byte) (*Installer, error) {
Suspended: false,
State: server.ProcessOfflineState,
Invocation: getString(data, "invocation"),
EnvVars: make(map[string]string),
EnvVars: make(server.EnvironmentVariables),
Build: server.BuildSettings{
MemoryLimit: getInt(data, "build", "memory"),
Swap: getInt(data, "build", "swap"),
@@ -55,7 +55,7 @@ func New(data []byte) (*Installer, error) {
if b, _, _, err := jsonparser.Get(data, "environment"); err != nil {
return nil, errors.WithStack(err)
} else {
s.EnvVars = make(map[string]string)
s.EnvVars = make(server.EnvironmentVariables)
if err := json.Unmarshal(b, &s.EnvVars); err != nil {
return nil, errors.WithStack(err)
}