Renamed VirtualServer to LogicalServer. Filled out some comments.

This commit is contained in:
Gary Talent 2016-02-27 16:45:20 -06:00
parent 89a9b98b35
commit ffafcb08a5
4 changed files with 10 additions and 5 deletions

View File

@ -3,10 +3,10 @@
"Services": { "Services": {
"Minecraft": { "Minecraft": {
"Port": 25565, "Port": 25565,
"VirtualDroplet": "minecraft" "LogicalDroplet": "minecraft"
} }
}, },
"VirtualDroplets": { "LogicalServers": {
"minecraft": { "minecraft": {
"Size": "4gb", "Size": "4gb",
"Region": "nyc3" "Region": "nyc3"

View File

@ -57,7 +57,7 @@ func (me *DropletHandler) Spinup(name string) (string, error) {
if err != nil { if err != nil {
return "", err return "", err
} }
vd := me.settings.VirtualServers[name] vd := me.settings.LogicalServers[name]
createRequest := &godo.DropletCreateRequest{ createRequest := &godo.DropletCreateRequest{
Name: DROPLET_NS + name, Name: DROPLET_NS + name,
Region: vd.Region, Region: vd.Region,

View File

@ -47,12 +47,17 @@ func NewServerManager(name string, server ServerHandler, settings Settings) *Ser
Serves channel requests. Serves channel requests.
*/ */
func (me *ServerManager) Serve() { func (me *ServerManager) Serve() {
// TODO: see if server is currently up, and setup port forwarding if so
// event loop
for running := true; running; { for running := true; running; {
select { select {
case action := <-me.in: case action := <-me.in:
running = me.serveAction(action) running = me.serveAction(action)
} }
} }
// notify done
me.done <- 42 me.done <- 42
} }

View File

@ -15,7 +15,7 @@ import (
type Settings struct { type Settings struct {
ApiToken string ApiToken string
Services map[string]Service Services map[string]Service
VirtualServers map[string]VirtualServer LogicalServers map[string]LogicalServer
} }
type Service struct { type Service struct {
@ -23,7 +23,7 @@ type Service struct {
LogicalServer string LogicalServer string
} }
type VirtualServer struct { type LogicalServer struct {
Size string Size string
Region string Region string
} }