From f9743f8a84291b2857f6d922f9e35abc0e03250d Mon Sep 17 00:00:00 2001 From: Marsn3 Date: Wed, 26 Feb 2025 12:45:25 +0100 Subject: [PATCH] Fix os.getenv and add more checks --- src/bot/bot.py | 7 +++++-- src/bot/devenv.nix | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bot/bot.py b/src/bot/bot.py index 0b48d8b..8d78a93 100644 --- a/src/bot/bot.py +++ b/src/bot/bot.py @@ -6,13 +6,16 @@ from enum import Enum DISCORD_TOKEN = os.getenv("DISCORD_TOKEN") PB_TOKEN = os.getenv("PB_TOKEN") -PB_URL = os.getenv("PB_TOKEN") -PB_COLLECTION = os.getenv("PB_TOKEN") +PB_URL = os.getenv("PB_URL") +PB_COLLECTION = os.getenv("PB_COLLECTION") for env in [DISCORD_TOKEN, PB_TOKEN, PB_URL, PB_COLLECTION]: if env is None: print("Missing env var") quit() + elif PB_URL is not None: + if PB_URL.startswith("https://"): + PB_URL = PB_URL.strip("https://") class Events(Enum): diff --git a/src/bot/devenv.nix b/src/bot/devenv.nix index d8207df..717757b 100644 --- a/src/bot/devenv.nix +++ b/src/bot/devenv.nix @@ -1,7 +1,6 @@ { pkgs, lib, config, inputs, ... }: { - packages = [pkgs.openssl pkgs.cacert]; dotenv.enable = true; # https://devenv.sh/languages/ languages.python.enable = true;