Skip to content

Commit 6769f5b

Browse files
committed
[+] Make update checking configurable
1 parent 5884f7e commit 6769f5b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lib/runtime/config.example.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ restful:
1919
host: "127.0.0.1"
2020
port: 7331
2121
# `enable: true` means starting RESTful Server when Platypus starts.
22-
enable: true
22+
enable: true
23+
# Check new releases from GitHub when starting Platypus
24+
update: true

platypus.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ type Config struct {
2525
Port int16 `yaml:"port"`
2626
Enable bool `yaml:"enable"`
2727
}
28+
Update bool
2829
}
2930

3031
func main() {
31-
// Detect new version
32-
update.ConfirmAndSelfUpdate()
33-
3432
// Detect and create config file
3533
configFilename := "config.yml"
3634
if !fs.FileExists(configFilename) {
@@ -46,6 +44,11 @@ func main() {
4644
// Create context
4745
context.CreateContext()
4846

47+
// Detect new version
48+
if config.Update {
49+
update.ConfirmAndSelfUpdate()
50+
}
51+
4952
// Init servers from config file
5053
for _, s := range config.Servers {
5154
server := context.CreateTCPServer(s.Host, uint16(s.Port), s.HashFormat)

0 commit comments

Comments
 (0)