Better configuration loading process for servers

Loads up to 10 configurations at once in parallel
This commit is contained in:
Dane Everitt
2019-03-24 18:39:01 -07:00
parent 29de97c857
commit 639d9edef5
8 changed files with 85 additions and 76 deletions

View File

@@ -1,16 +1,46 @@
package environment
import (
"github.com/pterodactyl/wings"
"os"
)
type Docker struct {
*Controller
// Defines the docker configuration used by the daemon when interacting with
// containers and networks on the system.
type DockerConfiguration struct {
Container struct {
User string
}
// Network configuration that should be used when creating a new network
// for containers run through the daemon.
Network struct {
// The interface that should be used to create the network. Must not conflict
// with any other interfaces in use by Docker or on the system.
Interface string
// The name of the network to use. If this network already exists it will not
// be created. If it is not found, a new network will be created using the interface
// defined.
Name string
}
// If true, container images will be updated when a server starts if there
// is an update available. If false the daemon will not attempt updates and will
// defer to the host system to manage image updates.
UpdateImages bool `yaml:"update_images"`
// The location of the Docker socket.
Socket string
// Defines the location of the timezone file on the host system that should
// be mounted into the created containers so that they all use the same time.
TimezonePath string `yaml:"timezone_path"`
}
type Docker struct {
// Defines the configuration for the Docker instance that will allow us to connect
// and create and modify containers.
Configuration wings.DockerConfiguration
Configuration DockerConfiguration
}
// Ensure that the Docker environment is always implementing all of the methods

View File

@@ -1,7 +1,6 @@
package environment
import (
"github.com/pterodactyl/wings/server"
"os"
)
@@ -24,12 +23,4 @@ type Environment interface {
// Terminates a running server instance using the provided signal. If the server
// is not running no error should be returned.
Terminate(signal os.Signal) error
}
// Defines an environment controller for a server instance. This can either be
// a docker environment where the server is running in a container, or a host
// CLI environment where it is not running in a container at all (theoretically).
type Controller struct {
// The server instance attached to this environment.
Server *server.Server
}
}