Rename the domain environment variable and use urljoin when joining URLs

This commit is contained in:
2022-04-20 16:47:47 +02:00
parent 506670e4de
commit 1676186e2f
6 changed files with 19 additions and 8 deletions

View File

@ -15,13 +15,13 @@ load_dotenv()
# Check if user has added a domain to the environment.
try:
domain = os.environ["DOMAIN"]
serve_domain = os.environ["SERVE_DOMAIN"]
except KeyError:
sys.exit("discord-embed: Environment variable 'DOMAIN' is missing!")
# Remove trailing slash from domain
if domain.endswith("/"):
domain = domain[:-1]
if serve_domain.endswith("/"):
serve_domain = serve_domain[:-1]
# Check if we have a folder for uploads.
try: