mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-25 17:49:49 +05:30
Unify socket_binding and socket_permissions
This commit is contained in:
parent
5f8130fd03
commit
48d2250024
@ -131,25 +131,16 @@ https_only: false
|
|||||||
#hsts: true
|
#hsts: true
|
||||||
|
|
||||||
##
|
##
|
||||||
## Path of a UNIX socket to listen on for incoming connections.
|
## Path and permissions of a UNIX socket to listen on for incoming connections.
|
||||||
##
|
##
|
||||||
## Note: Enabling socket will make invidious stop listening on the address
|
## Note: Enabling socket will make invidious stop listening on the address
|
||||||
## specified by 'host_binding' and 'port'.
|
## specified by 'host_binding' and 'port'.
|
||||||
##
|
##
|
||||||
## Accepted values: Any path to a new file (that doesn't exist yet)
|
## Accepted values: Any path to a new file (that doesn't exist yet) and its
|
||||||
|
## permissions following the UNIX octal convention.
|
||||||
## Default: <none>
|
## Default: <none>
|
||||||
##
|
##
|
||||||
#socket_binding: /tmp/invidious.sock
|
#socket_binding: /tmp/invidious.sock,777
|
||||||
|
|
||||||
##
|
|
||||||
## Permissions for the UNIX socket specified by 'socket_binding'.
|
|
||||||
##
|
|
||||||
## Note: The permissions are given in octal, following UNIX convention.
|
|
||||||
##
|
|
||||||
## Accepted values: 000-777
|
|
||||||
## Default: 777
|
|
||||||
##
|
|
||||||
#socket_permissions: 777
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
@ -249,13 +249,15 @@ Kemal.config.app_name = "Invidious"
|
|||||||
|
|
||||||
Kemal.run do |config|
|
Kemal.run do |config|
|
||||||
if CONFIG.socket_binding
|
if CONFIG.socket_binding
|
||||||
if File.exists?(CONFIG.socket_binding.not_nil!)
|
socket_binding = CONFIG.socket_binding.not_nil!
|
||||||
File.delete(CONFIG.socket_binding.not_nil!)
|
if File.exists?(socket_binding)
|
||||||
|
File.delete(socket_binding)
|
||||||
end
|
end
|
||||||
# Create a socket and set its desired permissions
|
# Create a socket and set its desired permissions
|
||||||
server = UNIXServer.new(CONFIG.socket_binding.not_nil!)
|
tokens = socket_binding.rpartition(',')
|
||||||
perms = CONFIG.socket_permissions.to_i(base: 8)
|
server = UNIXServer.new(tokens[0])
|
||||||
File.chmod(CONFIG.socket_binding.not_nil!, perms)
|
perms = tokens[2].to_i(base: 8)
|
||||||
|
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
|
||||||
|
@ -138,10 +138,8 @@ class Config
|
|||||||
property port : Int32 = 3000
|
property port : Int32 = 3000
|
||||||
# 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"
|
||||||
# Make Invidious listen on a UNIX socket instead of a TCP port - Example: /tmp/invidious.sock
|
# 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 : String? = nil
|
||||||
# Permissions of the listening socket in octal
|
|
||||||
property socket_permissions : String = "777"
|
|
||||||
# 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