Add environment variable for endpoint address
This commit is contained in:
		
							parent
							
								
									7088065a2d
								
							
						
					
					
						commit
						831a1d6ff6
					
				|  | @ -35,6 +35,7 @@ wireguard interface stats. See the `cap_add` and `network_mode` options on the d | |||
| | `SESSION_SECRET`            | Used to encrypt the session cookies. Set this to a random value.                                    | | ||||
| | `WGUI_USERNAME`             | The username for the login page. (default `admin`)                                                  | | ||||
| | `WGUI_PASSWORD`             | The password for the user on the login page. (default `admin`)                                      | | ||||
| | `WGUI_ENDPOINT_ADDRESS`     | The default endpoint address used in global settings. (default is your public IP address)           | | ||||
| | `WGUI_DNS`                  | The default DNS servers (comma-separated-list) used in the global settings. (default `1.1.1.1`)     | | ||||
| | `WGUI_MTU`                  | The default MTU used in global settings. (default `1450`)                                           | | ||||
| | `WGUI_PERSISTENT_KEEPALIVE` | The default persistent keepalive for WireGuard in global settings. (default `15`)                   | | ||||
|  |  | |||
|  | @ -88,7 +88,7 @@ func (o *JsonDB) Init() error { | |||
| 		} | ||||
| 
 | ||||
| 		globalSetting := new(model.GlobalSetting) | ||||
| 		globalSetting.EndpointAddress = publicInterface.IPAddress | ||||
| 		globalSetting.EndpointAddress = util.LookupEnvOrString(util.EndpointAddressEnvVar, publicInterface.IPAddress) | ||||
| 		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) | ||||
|  |  | |||
|  | @ -34,6 +34,7 @@ const ( | |||
| 	DefaultConfigFilePath                  = "/etc/wireguard/wg0.conf" | ||||
| 	UsernameEnvVar                         = "WGUI_USERNAME" | ||||
| 	PasswordEnvVar                         = "WGUI_PASSWORD" | ||||
| 	EndpointAddressEnvVar                  = "WGUI_ENDPOINT_ADDRESS" | ||||
| 	DNSEnvVar                              = "WGUI_DNS" | ||||
| 	MTUEnvVar                              = "WGUI_MTU" | ||||
| 	PersistentKeepaliveEnvVar              = "WGUI_PERSISTENT_KEEPALIVE" | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue