Remove server configurations files and add shared state file

This commit is contained in:
Matthew Penner
2020-04-10 16:33:30 -06:00
parent 28c8f3f400
commit 1e12b7b37c
6 changed files with 156 additions and 52 deletions

View File

@@ -5,6 +5,7 @@ import (
"github.com/asaskevich/govalidator"
"github.com/buger/jsonparser"
"github.com/pkg/errors"
"github.com/pterodactyl/wings/api"
"github.com/pterodactyl/wings/config"
"github.com/pterodactyl/wings/server"
"go.uber.org/zap"
@@ -74,17 +75,26 @@ func New(data []byte) (*Installer, error) {
s.Container.Image = getString(data, "container", "image")
b, err := s.WriteConfigurationToDisk()
c, rerr, err := api.NewRequester().GetServerConfiguration(s.Uuid)
if err != nil || rerr != nil {
if err != nil {
return nil, errors.WithStack(err)
}
return nil, errors.New(rerr.String())
}
/*b, err := s.WriteConfigurationToDisk()
if err != nil {
return nil, err
}
}*/
// Destroy the temporary server instance.
s = nil
// Create a new server instance using the configuration we wrote to the disk
// so that everything gets instantiated correctly on the struct.
s2, err := server.FromConfiguration(b, &config.Get().System, nil)
s2, err := server.FromConfiguration(c, &config.Get().System)
return &Installer{
server: s2,