Don't run install scripts if disabled; closes pterodactyl/panel#2265

This commit is contained in:
Dane Everitt
2020-08-30 09:41:14 -07:00
parent 9780cf902d
commit c69a0bb107
4 changed files with 29 additions and 8 deletions

View File

@@ -26,14 +26,11 @@ func New(data []byte) (*Installer, error) {
return nil, NewValidationError("uuid provided was not in a valid format")
}
if !govalidator.IsUUIDv4(getString(data, "service", "egg")) {
return nil, NewValidationError("service egg provided was not in a valid format")
}
cfg := &server.Configuration{
Uuid: getString(data, "uuid"),
Suspended: false,
Invocation: getString(data, "invocation"),
SkipEggScripts: getBoolean(data, "skip_egg_scripts"),
Build: environment.Limits{
MemoryLimit: getInt(data, "build", "memory"),
Swap: getInt(data, "build", "swap"),
@@ -117,7 +114,6 @@ func (i *Installer) Execute() {
}
l.Debug("creating required environment for server instance")
// TODO: ensure data directory exists.
if err := i.server.Environment.Create(); err != nil {
l.WithField("error", err).Error("failed to create environment for server")
return
@@ -139,3 +135,9 @@ func getInt(data []byte, key ...string) int64 {
return value
}
func getBoolean(data []byte, key ...string) bool {
value, _ := jsonparser.GetBoolean(data, key...)
return value
}