Skip to content

Commit

Permalink
Add warning when hostname starts with http (fixes #68)
Browse files Browse the repository at this point in the history
  • Loading branch information
milesmcc committed Aug 11, 2020
1 parent e4deab2 commit 2d42674
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions shynet/core/management/commands/hostname.py
Expand Up @@ -20,6 +20,12 @@ def add_arguments(self, parser):
def handle(self, *args, **options):
site = Site.objects.get(pk=settings.SITE_ID)
site.domain = options.get("hostname")
if options.get("hostname").lower().startswith("http"):
self.stdout.write(
self.style.WARNING(
f"Warning: the hostname '{options.get('hostname')}' starts with `http`. You almost certainly don't want this. The hostname is supposed to be the raw domain name of your Shynet instance, without `http://` or `https://`. For example, if your Shynet instance will eventually be hosted at `https://analytics.example.com`, the hostname should be `analytics.example.com`."
)
)
site.save()
self.stdout.write(
self.style.SUCCESS(
Expand Down

0 comments on commit 2d42674

Please sign in to comment.