mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-24 17:19:51 +05:30
Change socket_binding to a nested configuration in YAML
This commit is contained in:
parent
48d2250024
commit
275318dae2
@ -140,7 +140,9 @@ https_only: false
|
||||
## permissions following the UNIX octal convention.
|
||||
## Default: <none>
|
||||
##
|
||||
#socket_binding: /tmp/invidious.sock,777
|
||||
#socket_binding:
|
||||
# path: /tmp/invidious.sock
|
||||
# permissions: 777
|
||||
|
||||
|
||||
# -----------------------------
|
||||
|
@ -250,14 +250,13 @@ Kemal.config.app_name = "Invidious"
|
||||
Kemal.run do |config|
|
||||
if CONFIG.socket_binding
|
||||
socket_binding = CONFIG.socket_binding.not_nil!
|
||||
if File.exists?(socket_binding)
|
||||
File.delete(socket_binding)
|
||||
if File.exists?(socket_binding.path)
|
||||
File.delete(socket_binding.path)
|
||||
end
|
||||
# Create a socket and set its desired permissions
|
||||
tokens = socket_binding.rpartition(',')
|
||||
server = UNIXServer.new(tokens[0])
|
||||
perms = tokens[2].to_i(base: 8)
|
||||
File.chmod(tokens[0], perms)
|
||||
server = UNIXServer.new(socket_binding.path)
|
||||
perms = socket_binding.permissions.to_i(base: 8)
|
||||
File.chmod(socket_binding.path, perms)
|
||||
config.server.not_nil!.bind server
|
||||
else
|
||||
Kemal.config.host_binding = Kemal.config.host_binding != "0.0.0.0" ? Kemal.config.host_binding : CONFIG.host_binding
|
||||
|
@ -8,6 +8,13 @@ struct DBConfig
|
||||
property dbname : String
|
||||
end
|
||||
|
||||
struct SocketBindingConfig
|
||||
include YAML::Serializable
|
||||
|
||||
property path : String
|
||||
property permissions : String
|
||||
end
|
||||
|
||||
struct ConfigPreferences
|
||||
include YAML::Serializable
|
||||
|
||||
@ -139,7 +146,7 @@ class Config
|
||||
# Host to bind (overridden by command line argument)
|
||||
property host_binding : String = "0.0.0.0"
|
||||
# Path and permissions to make Invidious listen on a UNIX socket instead of a TCP port - Example: /tmp/invidious.sock,777
|
||||
property socket_binding : String? = nil
|
||||
property socket_binding : SocketBindingConfig? = nil
|
||||
# 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
|
||||
# HTTP Proxy configuration
|
||||
|
Loading…
Reference in New Issue
Block a user