add the ability to listen on unix sockets

This commit is contained in:
Emilien Devos 2021-05-22 17:42:23 +02:00
parent 960bd2a6be
commit 78773d7326
2 changed files with 13 additions and 3 deletions

View File

@ -3917,6 +3917,15 @@ add_context_storage_type(Preferences)
add_context_storage_type(User) add_context_storage_type(User)
Kemal.config.logger = LOGGER Kemal.config.logger = LOGGER
Kemal.config.host_binding = Kemal.config.host_binding != "0.0.0.0" ? Kemal.config.host_binding : CONFIG.host_binding
Kemal.config.port = Kemal.config.port != 3000 ? Kemal.config.port : CONFIG.port Kemal.run do |config|
Kemal.run if CONFIG.bind_unix
if File.exists?(CONFIG.bind_unix.not_nil!)
File.delete(CONFIG.bind_unix.not_nil!)
end
config.server.not_nil!.bind_unix CONFIG.bind_unix.not_nil!
else
config.host_binding = config.host_binding != "0.0.0.0" ? config.host_binding : CONFIG.host_binding
config.port = config.port != 3000 ? config.port : CONFIG.port
end
end

View File

@ -98,6 +98,7 @@ class Config
property force_resolve : Socket::Family = Socket::Family::UNSPEC # Connect to YouTube over 'ipv6', 'ipv4'. Will sometimes resolve fix issues with rate-limiting (see https://github.com/ytdl-org/youtube-dl/issues/21729) property force_resolve : Socket::Family = Socket::Family::UNSPEC # Connect to YouTube over 'ipv6', 'ipv4'. Will sometimes resolve fix issues with rate-limiting (see https://github.com/ytdl-org/youtube-dl/issues/21729)
property port : Int32 = 3000 # Port to listen for connections (overrided by command line argument) property port : Int32 = 3000 # Port to listen for connections (overrided by command line argument)
property host_binding : String = "0.0.0.0" # Host to bind (overrided by command line argument) property host_binding : String = "0.0.0.0" # Host to bind (overrided by command line argument)
property bind_unix : String? = nil # Make Invidious listening on UNIX sockets - Example: /tmp/invidious.sock
property pool_size : Int32 = 100 # Pool size for HTTP requests to youtube.com and ytimg.com (each domain has a separate pool of `pool_size`) property pool_size : Int32 = 100 # Pool size for HTTP requests to youtube.com and ytimg.com (each domain has a separate pool of `pool_size`)
property use_quic : Bool = true # Use quic transport for youtube api property use_quic : Bool = true # Use quic transport for youtube api