diff --git a/.gitignore b/.gitignore index 5a8389b..40a86c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .vscode/launch.json **/*.pyc +.env diff --git a/main.py b/main.py index 8e76b4b..6c8d17e 100644 --- a/main.py +++ b/main.py @@ -1,8 +1,11 @@ import os import sys import json +from dotenv import load_dotenv from lib.mqtt import create_client, update_disc, control_player, create_config +load_dotenv() + # Define the MQTT server details broker = os.environ.get("broker") port = int(os.environ.get("port")) @@ -30,4 +33,5 @@ else: print("No JSON argument passed, running default control_player action.") # You can still have the default behavior if no JSON is passed -control_player(client, "EJECT") +# control_player(client, "EJECT") + diff --git a/poetry.lock b/poetry.lock index 65765cd..d76cf17 100644 --- a/poetry.lock +++ b/poetry.lock @@ -14,7 +14,21 @@ files = [ [package.extras] proxy = ["pysocks"] +[[package]] +name = "python-dotenv" +version = "1.0.1" +description = "Read key-value pairs from a .env file and set them as environment variables" +optional = false +python-versions = ">=3.8" +files = [ + {file = "python-dotenv-1.0.1.tar.gz", hash = "sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca"}, + {file = "python_dotenv-1.0.1-py3-none-any.whl", hash = "sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a"}, +] + +[package.extras] +cli = ["click (>=5.0)"] + [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "6c033a93847eceeaa0c39046b8cf5ddd3b31e00b768adae8c60d059d3003b2f5" +content-hash = "a464e018da3c243fd5b889dddee79b9f4d25f520855325f8478224b55eebbbcc" diff --git a/pyproject.toml b/pyproject.toml index 3e81152..9594d86 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,7 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.8" paho-mqtt = "^2.1.0" +python-dotenv = "^1.0.1" [build-system]