Skip to content

Conversation

@Fijxu
Copy link
Member

@Fijxu Fijxu commented Jun 15, 2025

Closes #5351

image

@Fijxu Fijxu requested a review from syeopite June 15, 2025 21:11

# Check if the domain configuration is valid
if (domain = config.domain).nil? || domain.empty?
puts "Config: 'domain' is required/can't be empty"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

domain can be empty on local instances.

exit(1)
elsif parsed_domain = URI.parse(domain)
if domain != parsed_domain.domain
puts "Config: 'domain' is invalid.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
puts "Config: 'domain' is invalid.
puts "Config: 'domain' is invalid."

end

# Check if the domain configuration is valid
if (domain = config.domain).nil? || domain.empty?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way you can use String.presence instead of a separate nil/empty check

Suggested change
if (domain = config.domain).nil? || domain.empty?
if !config.domain.presence

@unixfox
Copy link
Member

unixfox commented Dec 3, 2025

@Fijxu could you check @SamantazFox reviews :)?

@Fijxu
Copy link
Member Author

Fijxu commented Dec 6, 2025

I did something more complicated while testing but this seems to be enough.

$ INVIDIOUS_DOMAIN=https://inv.nadeko.net:8080/meow/asd/meow ./invidious
Config (Hint): Remove the path from your domain: '/meow/asd/meow'
$ INVIDIOUS_DOMAIN=https://inv.nadeko.net:8080 ./invidious
Config (Hint): Remove the scheme from your domain: 'https://'
$ INVIDIOUS_DOMAIN=inv.nadeko.net:8080 ./invidious
Config (Hint): Remove the port from your domain: ':8080'
$ INVIDIOUS_DOMAIN=inv.nadeko.net/asd/asd/asd ./invidious
Config (Hint): Remove the path from your domain: '/asd/asd/asd'
$ INVIDIOUS_DOMAIN=https://inv.nadeko.net ./invidious
Config (Hint): Remove the scheme from your domain: 'https://'
$ INVIDIOUS_DOMAIN=tcp://inv.nadeko.net ./invidious
Config (Hint): Remove the scheme from your domain: 'tcp://'
$ INVIDIOUS_DOMAIN=meow ./invidious
[development] Invidious is ready to lead at http://0.0.0.0:30001

$ INVIDIOUS_DOMAIN=meow.localhost ./invidious
[development] Invidious is ready to lead at http://0.0.0.0:30001

$ INVIDIOUS_DOMAIN=meow.localhost.lol ./invidious
[development] Invidious is ready to lead at http://0.0.0.0:30001

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Detect and warn on common domain config misconfigurations

3 participants