diff --git a/README.md b/README.md index 3cc5dd5..a4057cf 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ Clients can also use [go-dos-yourself](https://github.com/seantcanavan/go-dos-yo 2. CheckInGmailPassword - set this to the password to the above gmail address. 3. CheckInFrequencySeconds - set this to the frequency at which you'd like to receive system reports at your specified email address. value is in seconds. 4. NetQueryFrequencySeconds - set this to the frequency at which you'd like anon-eth-net to check for internet connectivity. - 5. UpdateFrequencySeconds - set this to the frequency at which you'd like anon-eth-net to check for updates to itself. 2. Optionally update the optional values in assets/config.json: 1. DeviceName - set this to the canonical name of the device which will be executing anon-eth-net. e.g. "main desktop", "garage pc", "sister's laptop", etc. 2. DeviceId - if you wish to use your own method of uniquely identifying your remote devices fill in that value here otherwise anon-eth-net will generate a GUID for you automatically. diff --git a/src/github.com/seantcanavan/assets/config.json b/src/github.com/seantcanavan/assets/config.json index 7f10be0..f5dbc52 100644 --- a/src/github.com/seantcanavan/assets/config.json +++ b/src/github.com/seantcanavan/assets/config.json @@ -3,7 +3,6 @@ "CheckInGmailPassword" : "yourgmailpasswordhere", "CheckInFrequencySeconds" : 3600, "NetQueryFrequencySeconds" : 3600, - "UpdateFrequencySeconds": 3600, "DeviceName" : "My Little Raspberry Pi", "DeviceId" : "aa3b2cd6-7a95-4b2a-af33-7eb953d730a9" diff --git a/src/github.com/seantcanavan/config/config.go b/src/github.com/seantcanavan/config/config.go index d6fe962..7dfb4c5 100644 --- a/src/github.com/seantcanavan/config/config.go +++ b/src/github.com/seantcanavan/config/config.go @@ -9,7 +9,6 @@ import ( "math/rand" "strconv" "strings" - "time" "github.com/nu7hatch/gouuid" "github.com/seantcanavan/logger" @@ -30,8 +29,8 @@ var Cfg *Config type Config struct { CheckInGmailAddress string `json:"CheckInGmailAddress"` // (R) the gmail address to send updates to and receive updates from. parsed from line 1 of CheckInEmailCredentialsFile CheckInGmailPassword string `json:"CheckInGmailPassword"` // (R) the password for the gmail account. parsed from line 2 of CheckInEmailCredentialsFile - CheckInFrequencySeconds time.Duration `json:"CheckInFrequencySeconds"` // (R) The frequency with which this program will send status updates. In seconds. - NetQueryFrequencySeconds time.Duration `json:"NetQueryFrequencySeconds"` // (R) The frequency with which this program will attempt to connect to the outside world to verify internet connectivity + CheckInFrequencySeconds int `json:"CheckInFrequencySeconds"` // (R) The frequency with which this program will send status updates. In seconds. + NetQueryFrequencySeconds int `json:"NetQueryFrequencySeconds"` // (R) The frequency with which this program will attempt to connect to the outside world to verify internet connectivity DeviceName string `json:"DeviceName"` // (O) The canonical DeviceName for the machine currently executing this program. DeviceId string `json:"DeviceId"` // (O) The unique ID for the machine currently executing this program. InitialStartup string `json:"InitialStartup"` // (D) Whether or not this is the first time that the program is starting. diff --git a/src/github.com/seantcanavan/network/network.go b/src/github.com/seantcanavan/network/network.go index a0d1b2b..91095fc 100644 --- a/src/github.com/seantcanavan/network/network.go +++ b/src/github.com/seantcanavan/network/network.go @@ -93,7 +93,7 @@ func (con *Network) Run() { interval := config.Cfg.NetQueryFrequencySeconds - logger.Lgr.LogMessage("Network manager will sleep for %d seconds before querying the internet", config.Cfg.NetQueryFrequencySeconds) + logger.Lgr.LogMessage("Network manager will sleep for %d seconds before querying the internet", interval) time.Sleep(time.Duration(interval) * time.Second) diff --git a/src/github.com/seantcanavan/updater/updater.go b/src/github.com/seantcanavan/updater/updater.go index 89bf85d..4a03753 100644 --- a/src/github.com/seantcanavan/updater/updater.go +++ b/src/github.com/seantcanavan/updater/updater.go @@ -19,10 +19,10 @@ func Run() { go func() { - for 1 == 1 { + for 1 == 1 { - logger.Lgr.LogMessage("waiting for updates. sleeping %v", config.Cfg.CheckInFrequencySeconds) - time.Sleep(config.Cfg.CheckInFrequencySeconds * time.Second) + logger.Lgr.LogMessage("waiting for updates. sleeping %v", config.Cfg.UpdateFrequencySeconds) + time.Sleep(time.Duration(config.Cfg.UpdateFrequencySeconds) * time.Second) local := config.Cfg.LocalVersion remote, remoteErr := remoteVersion() diff --git a/src/github.com/seantcanavan/updater/updater_test.go b/src/github.com/seantcanavan/updater/updater_test.go index 3e63949..c501a8e 100644 --- a/src/github.com/seantcanavan/updater/updater_test.go +++ b/src/github.com/seantcanavan/updater/updater_test.go @@ -40,7 +40,7 @@ func TestVersionCompare(t *testing.T) { func TestRun(t *testing.T) { - config.Cfg.CheckInFrequencySeconds = 2 + config.Cfg.UpdateFrequencySeconds = 2 Run() time.Sleep(time.Second * 6)