Skip to content

Commit

Permalink
Disable automatic endpoint address detection when endpoint is supplied (
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusWichelmann authored Dec 2, 2022
1 parent 033bea6 commit 9d2dd71
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions store/jsondb/jsondb.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,18 @@ func (o *JsonDB) Init() error {

// global settings
if _, err := os.Stat(globalSettingPath); os.IsNotExist(err) {

publicInterface, err := util.GetPublicIP()
if err != nil {
return err
endpointAddress := util.LookupEnvOrString(util.EndpointAddressEnvVar, "")
if endpointAddress == "" {
// automatically find an external IP address
publicInterface, err := util.GetPublicIP()
if err != nil {
return err
}
endpointAddress = publicInterface.IPAddress
}

globalSetting := new(model.GlobalSetting)
globalSetting.EndpointAddress = util.LookupEnvOrString(util.EndpointAddressEnvVar, publicInterface.IPAddress)
globalSetting.EndpointAddress = endpointAddress
globalSetting.DNSServers = util.LookupEnvOrStrings(util.DNSEnvVar, []string{util.DefaultDNS})
globalSetting.MTU = util.LookupEnvOrInt(util.MTUEnvVar, util.DefaultMTU)
globalSetting.PersistentKeepalive = util.LookupEnvOrInt(util.PersistentKeepaliveEnvVar, util.DefaultPersistentKeepalive)
Expand Down

0 comments on commit 9d2dd71

Please sign in to comment.