Skip to content

Commit

Permalink
Improve syntax
Browse files Browse the repository at this point in the history
Co-authored-by: syeopite <[email protected]>
  • Loading branch information
Caian and syeopite authored Jan 5, 2025
1 parent 525dea1 commit b4a6193
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/invidious.cr
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,8 @@ Kemal.config.app_name = "Invidious"
{% end %}

Kemal.run do |config|
if CONFIG.socket_binding
socket_binding = CONFIG.socket_binding.not_nil!
if File.exists?(socket_binding.path)
File.delete(socket_binding.path)
end
if socket_binding = CONFIG.socket_binding
File.delete?(socket_binding.path)
# Create a socket and set its desired permissions
server = UNIXServer.new(socket_binding.path)
perms = socket_binding.permissions.to_i(base: 8)
Expand Down
3 changes: 1 addition & 2 deletions src/invidious/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,7 @@ class Config
end

# Check if the socket configuration is valid
if config.socket_binding
sb = config.socket_binding.not_nil!
if sb = config.socket_binding
if sb.path.ends_with?("/") || File.directory?(sb.path)
puts "Config: The socket path " + sb.path + " must not be a directory!"
exit(1)
Expand Down

0 comments on commit b4a6193

Please sign in to comment.