From 4bdf373ab89872a349958257737f0bf9f1ac7422 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 24 Mar 2019 17:39:13 -0700 Subject: [PATCH] Cleanup to better match the revised server data format --- .editorconfig | 11 ----------- config/.gitignore | 1 + config/servers/.gitkeep | 0 server/server.go | 19 ++++++++++++------- 4 files changed, 13 insertions(+), 18 deletions(-) delete mode 100644 .editorconfig create mode 100644 config/.gitignore create mode 100644 config/servers/.gitkeep diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index e99c7f5..0000000 --- a/.editorconfig +++ /dev/null @@ -1,11 +0,0 @@ -root = true - -[*] -indent_style = space -indent_size = 4 -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false \ No newline at end of file diff --git a/config/.gitignore b/config/.gitignore new file mode 100644 index 0000000..a0a464b --- /dev/null +++ b/config/.gitignore @@ -0,0 +1 @@ +servers diff --git a/config/servers/.gitkeep b/config/servers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/server/server.go b/server/server.go index da6cc75..779eb37 100644 --- a/server/server.go +++ b/server/server.go @@ -20,10 +20,15 @@ type Server struct { // The power state of the server. State int + // The command that should be used when booting up the server instance. + Invocation string + + // An array of environment variables that should be passed along to the running + // server process. EnvVars map[string]string `yaml:"env"` - Build *BuildSettings - Network *Allocations + Build *BuildSettings + Allocations *Allocations environment *environment.Environment } @@ -33,22 +38,22 @@ type Server struct { type BuildSettings struct { // The total amount of memory in megabytes that this server is allowed to // use on the host system. - MemoryLimit int + MemoryLimit int `yaml:"memory"` // The amount of additional swap space to be provided to a container instance. Swap int // The relative weight for IO operations in a container. This is relative to other // containers on the system and should be a value between 10 and 1000. - IoWeight int + IoWeight int `yaml:"io"` // The percentage of CPU that this instance is allowed to consume relative to // the host. A value of 200% represents complete utilization of two cores. This // should be a value between 1 and THREAD_COUNT * 100. - CpuLimit int + CpuLimit int `yaml:"cpu"` // The amount of disk space in megabytes that a server is allowed to use. - DiskSpace int + DiskSpace int `yaml:"disk"` } // Defines the allocations available for a given server. When using the Docker environment @@ -60,7 +65,7 @@ type Allocations struct { DefaultMapping struct { Ip string Port int - } + } `yaml:"default"` // Mappings contains all of the ports that should be assigned to a given server // attached to the IP they correspond to.