mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-07 13:44:17 +08:00
Added config file handling for public IP service.
This commit is contained in:
parent
a2f2b81142
commit
067d2aca2d
3 changed files with 9 additions and 1 deletions
|
@ -69,6 +69,7 @@ type ServerConfig struct {
|
|||
MQPort string `yaml:"mqport"`
|
||||
MQServerPort string `yaml:"mqserverport"`
|
||||
Server string `yaml:"server"`
|
||||
PublicIPService string `yaml:"publicIPService"`
|
||||
}
|
||||
|
||||
// SQLConfig - Generic SQL Config
|
||||
|
|
|
@ -11,3 +11,4 @@ server:
|
|||
disableremoteipcheck: "" # defaults to "false" or DISABLE_REMOTE_IP_CHECK (if set)
|
||||
version: "" # version of server
|
||||
rce: "" # defaults to "off"
|
||||
publicIpService: "" # defaults to "" or PUBLIC_IP_SERVICE (if set)
|
||||
|
|
|
@ -430,7 +430,13 @@ func GetPublicIP() (string, error) {
|
|||
iplist := []string{"https://ip.server.gravitl.com", "https://ifconfig.me", "https://api.ipify.org", "https://ipinfo.io/ip"}
|
||||
publicIpService := os.Getenv("PUBLIC_IP_SERVICE")
|
||||
if publicIpService != "" {
|
||||
logger.Log(3, "User provided public IP service is", publicIpService)
|
||||
logger.Log(3, "User (environment variable) provided public IP service is", publicIpService)
|
||||
|
||||
// prepend the user-specified service so it's checked first
|
||||
iplist = append([]string{publicIpService}, iplist...)
|
||||
} else if config.Config.Server.PublicIPService != "" {
|
||||
publicIpService = config.Config.Server.PublicIPService
|
||||
logger.Log(3, "User (config file) provided public IP service is", publicIpService)
|
||||
|
||||
// prepend the user-specified service so it's checked first
|
||||
iplist = append([]string{publicIpService}, iplist...)
|
||||
|
|
Loading…
Add table
Reference in a new issue