diff options
| author | Caian Benedicto <caianbene@gmail.com> | 2024-12-14 06:53:30 -0300 |
|---|---|---|
| committer | Caian Benedicto <caianbene@gmail.com> | 2024-12-14 06:53:30 -0300 |
| commit | 48d225002427e874a3b02ee0ba88ba6169304c52 (patch) | |
| tree | 4822bf151035ccd8ffed1edb35c655b0bf38351d /src | |
| parent | 5f8130fd03a767f77bf8abe4a3f7260d2781850a (diff) | |
| download | invidious-48d225002427e874a3b02ee0ba88ba6169304c52.tar.gz invidious-48d225002427e874a3b02ee0ba88ba6169304c52.tar.bz2 invidious-48d225002427e874a3b02ee0ba88ba6169304c52.zip | |
Unify socket_binding and socket_permissions
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious.cr | 12 | ||||
| -rw-r--r-- | src/invidious/config.cr | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 92ae8045..afbffcde 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -249,13 +249,15 @@ Kemal.config.app_name = "Invidious" Kemal.run do |config| if CONFIG.socket_binding - if File.exists?(CONFIG.socket_binding.not_nil!) - File.delete(CONFIG.socket_binding.not_nil!) + socket_binding = CONFIG.socket_binding.not_nil! + if File.exists?(socket_binding) + File.delete(socket_binding) end # Create a socket and set its desired permissions - server = UNIXServer.new(CONFIG.socket_binding.not_nil!) - perms = CONFIG.socket_permissions.to_i(base: 8) - File.chmod(CONFIG.socket_binding.not_nil!, perms) + tokens = socket_binding.rpartition(',') + server = UNIXServer.new(tokens[0]) + perms = tokens[2].to_i(base: 8) + File.chmod(tokens[0], 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 diff --git a/src/invidious/config.cr b/src/invidious/config.cr index 7c9e9ca6..feda3958 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -138,10 +138,8 @@ class Config property port : Int32 = 3000 # Host to bind (overridden by command line argument) 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 - # 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`) property pool_size : Int32 = 100 # HTTP Proxy configuration |
