Correctly set the server state on install; closes pterodactyl/panel#2236
This commit is contained in:
parent
4d3a860604
commit
9d2321f357
|
@ -57,10 +57,9 @@ func (s *Server) Install(sync bool) error {
|
|||
l.Warn("failed to notify panel of server install state")
|
||||
}
|
||||
|
||||
// Some how these publish events are sent to clients in reverse order,
|
||||
// this is probably due to channels having the most recently sent item first.
|
||||
// Ensure that the server is marked as offline.
|
||||
s.Events().Publish(StatusEvent, environment.ProcessOfflineState)
|
||||
// Ensure that the server is marked as offline at this point, otherwise you end up
|
||||
// with a blank value which is a bit confusing.
|
||||
s.SetState(environment.ProcessOfflineState)
|
||||
|
||||
// Push an event to the websocket so we can auto-refresh the information in the panel once
|
||||
// the install is completed.
|
||||
|
|
|
@ -79,12 +79,15 @@ func LoadDirectory() error {
|
|||
func FromConfiguration(data *api.ServerConfigurationResponse) (*Server, error) {
|
||||
cfg := Configuration{}
|
||||
if err := defaults.Set(&cfg); err != nil {
|
||||
return nil, err
|
||||
return nil, errors.WithMessage(err, "failed to set struct defaults for server configuration")
|
||||
}
|
||||
|
||||
s := new(Server)
|
||||
s.cfg = cfg
|
||||
if err := defaults.Set(s); err != nil {
|
||||
return nil, errors.WithMessage(err, "failed to set struct defaults for server")
|
||||
}
|
||||
|
||||
s.cfg = cfg
|
||||
if err := s.UpdateDataStructure(data.Settings, false); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
package server
|
||||
|
||||
import "github.com/pterodactyl/wings/api"
|
||||
|
||||
func (s *Server) ProcessConfiguration() *api.ProcessConfiguration {
|
||||
s.RLock()
|
||||
defer s.RUnlock()
|
||||
|
||||
return s.procConfig
|
||||
}
|
|
@ -185,3 +185,10 @@ func (s *Server) IsSuspended() bool {
|
|||
func (s *Server) Build() *environment.Limits {
|
||||
return &s.Config().Build
|
||||
}
|
||||
|
||||
func (s *Server) ProcessConfiguration() *api.ProcessConfiguration {
|
||||
s.RLock()
|
||||
defer s.RUnlock()
|
||||
|
||||
return s.procConfig
|
||||
}
|
Loading…
Reference in New Issue
Block a user