[go: nahoru, domu]

Skip to content

Commit

Permalink
[+] Make update checking configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
WangYihang committed Apr 12, 2021
1 parent 5884f7e commit 6769f5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/runtime/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ restful:
host: "127.0.0.1"
port: 7331
# `enable: true` means starting RESTful Server when Platypus starts.
enable: true
enable: true
# Check new releases from GitHub when starting Platypus
update: true
9 changes: 6 additions & 3 deletions platypus.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ type Config struct {
Port int16 `yaml:"port"`
Enable bool `yaml:"enable"`
}
Update bool
}

func main() {
// Detect new version
update.ConfirmAndSelfUpdate()

// Detect and create config file
configFilename := "config.yml"
if !fs.FileExists(configFilename) {
Expand All @@ -46,6 +44,11 @@ func main() {
// Create context
context.CreateContext()

// Detect new version
if config.Update {
update.ConfirmAndSelfUpdate()
}

// Init servers from config file
for _, s := range config.Servers {
server := context.CreateTCPServer(s.Host, uint16(s.Port), s.HashFormat)
Expand Down

0 comments on commit 6769f5b

Please sign in to comment.