forked from jan-leila/nix-config
		
	refactor: moved subdomain options into proxy file
This commit is contained in:
		
							parent
							
								
									dfdd6bcc82
								
							
						
					
					
						commit
						9b02e30080
					
				
					 16 changed files with 84 additions and 73 deletions
				
			
		|  | @ -2,23 +2,32 @@ | |||
|   lib, | ||||
|   config, | ||||
|   ... | ||||
| }: | ||||
| lib.mkIf (config.host.reverse_proxy.enable && config.services.home-assistant.enable) { | ||||
|   host = { | ||||
|     reverse_proxy.subdomains.${config.services.home-assistant.subdomain} = { | ||||
|       target = "http://localhost:${toString config.services.home-assistant.config.http.server_port}"; | ||||
| }: { | ||||
|   options.services.home-assistant = { | ||||
|     subdomain = lib.mkOption { | ||||
|       type = lib.types.str; | ||||
|       description = "subdomain of base domain that home-assistant will be hosted at"; | ||||
|       default = "home-assistant"; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|       websockets.enable = true; | ||||
|       forwardHeaders.enable = true; | ||||
|   config = lib.mkIf (config.host.reverse_proxy.enable && config.services.home-assistant.enable) { | ||||
|     host = { | ||||
|       reverse_proxy.subdomains.${config.services.home-assistant.subdomain} = { | ||||
|         target = "http://localhost:${toString config.services.home-assistant.config.http.server_port}"; | ||||
| 
 | ||||
|       extraConfig = '' | ||||
|         add_header Upgrade $http_upgrade; | ||||
|         add_header Connection \"upgrade\"; | ||||
|         websockets.enable = true; | ||||
|         forwardHeaders.enable = true; | ||||
| 
 | ||||
|         proxy_buffering off; | ||||
|         extraConfig = '' | ||||
|           add_header Upgrade $http_upgrade; | ||||
|           add_header Connection \"upgrade\"; | ||||
| 
 | ||||
|         proxy_read_timeout 90; | ||||
|       ''; | ||||
|           proxy_buffering off; | ||||
| 
 | ||||
|           proxy_read_timeout 90; | ||||
|         ''; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue