Define global default value at initialisation
This commit is contained in:
parent
41c543eb59
commit
c2dd27d9a5
9 changed files with 31 additions and 33 deletions
|
@ -12,12 +12,10 @@ import (
|
|||
|
||||
const startedFile = "started"
|
||||
|
||||
var SettingsDir string
|
||||
|
||||
var touchTimer *time.Timer = nil
|
||||
|
||||
func touchStartedFile() {
|
||||
if fd, err := os.Create(path.Join(SettingsDir, startedFile)); err == nil {
|
||||
if fd, err := os.Create(path.Join(settings.SettingsDir, startedFile)); err == nil {
|
||||
log.Println("Started! Go, Go, Go!!")
|
||||
fd.Close()
|
||||
} else {
|
||||
|
@ -34,8 +32,8 @@ func reloadSettings(config settings.FICSettings) {
|
|||
if startSub > 0 {
|
||||
log.Println("Challenge will starts at", config.Start, "in", startSub)
|
||||
|
||||
if _, err := os.Stat(path.Join(SettingsDir, startedFile)); !os.IsNotExist(err) {
|
||||
os.Remove(path.Join(SettingsDir, startedFile))
|
||||
if _, err := os.Stat(path.Join(settings.SettingsDir, startedFile)); !os.IsNotExist(err) {
|
||||
os.Remove(path.Join(settings.SettingsDir, startedFile))
|
||||
}
|
||||
|
||||
touchTimer = time.AfterFunc(config.Start.Sub(time.Now().Add(time.Duration(1 * time.Second))), touchStartedFile)
|
||||
|
|
Reference in a new issue