2016-02-14 23:38:28 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"io/ioutil"
|
|
|
|
)
|
|
|
|
|
2016-02-15 00:18:56 -06:00
|
|
|
type Settings struct {
|
2016-02-14 23:38:28 -06:00
|
|
|
Token string
|
|
|
|
VirtualDroplets map[string]VirtualDroplet
|
|
|
|
}
|
|
|
|
|
|
|
|
type VirtualDroplet struct {
|
|
|
|
Size string
|
|
|
|
Region string
|
|
|
|
}
|
|
|
|
|
2016-02-15 00:18:56 -06:00
|
|
|
func loadSettings(path string) (Settings, error) {
|
|
|
|
var s Settings
|
2016-02-14 23:38:28 -06:00
|
|
|
data, err := ioutil.ReadFile(path)
|
|
|
|
if err != nil {
|
|
|
|
return s, err
|
|
|
|
}
|
|
|
|
|
|
|
|
err = json.Unmarshal(data, &s)
|
|
|
|
if err != nil {
|
|
|
|
return s, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return s, err
|
|
|
|
}
|