mirror of
https://github.com/iv-org/invidious.git
synced 2025-12-18 01:44:26 -05:00
better domain missconfiguration checking
This commit is contained in:
parent
a3363fa9bc
commit
a48e6ca65b
1 changed files with 13 additions and 12 deletions
|
|
@ -320,19 +320,20 @@ class Config
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if the domain configuration is valid
|
# Check if the domain configuration is valid
|
||||||
if (domain = config.domain).nil? || domain.empty?
|
if (domain = config.domain)
|
||||||
puts "Config: 'domain' is required/can't be empty"
|
if parsed_domain = URI.parse(domain)
|
||||||
exit(1)
|
if port = parsed_domain.path.to_i?
|
||||||
elsif parsed_domain = URI.parse(domain)
|
puts "Config (Hint): Remove the port from your domain: ':#{port}'"
|
||||||
if domain != parsed_domain.domain
|
exit(1)
|
||||||
puts "Config: 'domain' is invalid.
|
end
|
||||||
|
if scheme = parsed_domain.scheme.presence
|
||||||
if parsed_domain.host.presence
|
puts "Config (Hint): Remove the scheme from your domain: '#{scheme}'"
|
||||||
puts "Config: (Hint) Did you mean #{parsed_domain.host} ?"
|
exit(1)
|
||||||
else
|
end
|
||||||
puts "Config: (Hint) 'domain' should look like this: invidious.example.com"
|
if host = parsed_domain.host.presence
|
||||||
|
puts "Config (Hint): Did you mean #{host}?"
|
||||||
|
exit(1)
|
||||||
end
|
end
|
||||||
exit(1)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue