Removes SyncServersOnBoot configuration option and requires that servers are synced when the daemon boots
This commit is contained in:
parent
2278347b4c
commit
e719c67e0b
|
@ -82,11 +82,6 @@ type SystemConfiguration struct {
|
||||||
Gid int
|
Gid int
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determines whether or not server data should be synced when the Daemon is started.
|
|
||||||
// If set to false, data will only be synced when a server process is started, or
|
|
||||||
// detected as started when booting.
|
|
||||||
SyncServersOnBoot bool `default:"true" yaml:"sync_servers_on_boot"`
|
|
||||||
|
|
||||||
// The path to the system's timezone file that will be mounted into running Docker containers.
|
// The path to the system's timezone file that will be mounted into running Docker containers.
|
||||||
TimezonePath string `yaml:"timezone_path"`
|
TimezonePath string `yaml:"timezone_path"`
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ func New(data []byte) (*Installer, error) {
|
||||||
|
|
||||||
// Create a new server instance using the configuration we wrote to the disk
|
// Create a new server instance using the configuration we wrote to the disk
|
||||||
// so that everything gets instantiated correctly on the struct.
|
// so that everything gets instantiated correctly on the struct.
|
||||||
s2, err := server.FromConfiguration(b, &config.Get().System, true)
|
s2, err := server.FromConfiguration(b, &config.Get().System)
|
||||||
|
|
||||||
return &Installer{
|
return &Installer{
|
||||||
server: s2,
|
server: s2,
|
||||||
|
|
|
@ -179,7 +179,7 @@ func LoadDirectory(dir string, cfg *config.SystemConfiguration) error {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
s, err := FromConfiguration(b, cfg, false)
|
s, err := FromConfiguration(b, cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if IsServerDoesNotExistError(err) {
|
if IsServerDoesNotExistError(err) {
|
||||||
zap.S().Infow("server does not exist on remote system", zap.String("server", file.Name()))
|
zap.S().Infow("server does not exist on remote system", zap.String("server", file.Name()))
|
||||||
|
@ -209,7 +209,7 @@ func (s *Server) Init() {
|
||||||
// Initializes a server using a data byte array. This will be marshaled into the
|
// Initializes a server using a data byte array. This will be marshaled into the
|
||||||
// given struct using a YAML marshaler. This will also configure the given environment
|
// given struct using a YAML marshaler. This will also configure the given environment
|
||||||
// for a server.
|
// for a server.
|
||||||
func FromConfiguration(data []byte, cfg *config.SystemConfiguration, forceSync bool) (*Server, error) {
|
func FromConfiguration(data []byte, cfg *config.SystemConfiguration) (*Server, error) {
|
||||||
s := new(Server)
|
s := new(Server)
|
||||||
|
|
||||||
if err := defaults.Set(s); err != nil {
|
if err := defaults.Set(s); err != nil {
|
||||||
|
@ -241,13 +241,9 @@ func FromConfiguration(data []byte, cfg *config.SystemConfiguration, forceSync b
|
||||||
}
|
}
|
||||||
s.Resources = ResourceUsage{}
|
s.Resources = ResourceUsage{}
|
||||||
|
|
||||||
// This is also done when the server is booted, however we need to account for instances
|
// Forces the configuration to be synced with the panel.
|
||||||
// where the server is already running and the Daemon reboots. In those cases this will
|
if err := s.Sync(); err != nil {
|
||||||
// allow us to you know, stop servers.
|
return nil, err
|
||||||
if forceSync || cfg.SyncServersOnBoot {
|
|
||||||
if err := s.Sync(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return s, nil
|
return s, nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user