Fix #261 add variable HTTP_CONTROL_SERVER_PORT

This commit is contained in:
Quentin McGaw
2020-10-17 22:07:15 +00:00
parent 6f4be72785
commit 8abc22977c
6 changed files with 60 additions and 2 deletions

View File

@@ -110,6 +110,9 @@ type Reader interface {
// Public IP getters
GetPublicIPPeriod() (period time.Duration, err error)
// Control server
GetControlServerPort() (port uint16, err error)
GetVersionInformation() (enabled bool, err error)
GetUpdaterPeriod() (period time.Duration, err error)

13
internal/params/server.go Normal file
View File

@@ -0,0 +1,13 @@
package params
import (
libparams "github.com/qdm12/golibs/params"
)
func (r *reader) GetControlServerPort() (port uint16, err error) {
n, err := r.envParams.GetEnvIntRange("HTTP_CONTROL_SERVER_PORT", 1, 65535, libparams.Default("8000"))
if err != nil {
return 0, err
}
return uint16(n), nil
}