mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-22 13:33:38 +00:00
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.
|
## permissions following the UNIX octal convention.
|
||||||
## Default: <none>
|
## 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|
|
Kemal.run do |config|
|
||||||
if CONFIG.socket_binding
|
if CONFIG.socket_binding
|
||||||
socket_binding = CONFIG.socket_binding.not_nil!
|
socket_binding = CONFIG.socket_binding.not_nil!
|
||||||
if File.exists?(socket_binding)
|
if File.exists?(socket_binding.path)
|
||||||
File.delete(socket_binding)
|
File.delete(socket_binding.path)
|
||||||
end
|
end
|
||||||
# Create a socket and set its desired permissions
|
# Create a socket and set its desired permissions
|
||||||
tokens = socket_binding.rpartition(',')
|
server = UNIXServer.new(socket_binding.path)
|
||||||
server = UNIXServer.new(tokens[0])
|
perms = socket_binding.permissions.to_i(base: 8)
|
||||||
perms = tokens[2].to_i(base: 8)
|
File.chmod(socket_binding.path, perms)
|
||||||
File.chmod(tokens[0], perms)
|
|
||||||
config.server.not_nil!.bind server
|
config.server.not_nil!.bind server
|
||||||
else
|
else
|
||||||
Kemal.config.host_binding = Kemal.config.host_binding != "0.0.0.0" ? Kemal.config.host_binding : CONFIG.host_binding
|
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
|
property dbname : String
|
||||||
end
|
end
|
||||||
|
|
||||||
|
struct SocketBindingConfig
|
||||||
|
include YAML::Serializable
|
||||||
|
|
||||||
|
property path : String
|
||||||
|
property permissions : String
|
||||||
|
end
|
||||||
|
|
||||||
struct ConfigPreferences
|
struct ConfigPreferences
|
||||||
include YAML::Serializable
|
include YAML::Serializable
|
||||||
|
|
||||||
@ -139,7 +146,7 @@ class Config
|
|||||||
# Host to bind (overridden by command line argument)
|
# Host to bind (overridden by command line argument)
|
||||||
property host_binding : String = "0.0.0.0"
|
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
|
# 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`)
|
# 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
|
property pool_size : Int32 = 100
|
||||||
# HTTP Proxy configuration
|
# HTTP Proxy configuration
|
||||||
|
Loading…
Reference in New Issue
Block a user