Skip to content

Commit

Permalink
Log EnvSettings setitem, default port 8002, Telegram logging, FlaskEnv
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsimpson committed Dec 31, 2023
1 parent eaae784 commit 7207b2a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ PUBLIC_KEY="/tmp/public.pem"


# Optional
TELEGRAM_TOKEN=
TELEGRAM_CHAT_ID=
TELEGRAM_PYTHON_LOG_LEVEL="ERROR"
TELEGRAM_TOKEN=${TELEGRAM_TOKEN}
TELEGRAM_CHAT_ID=${TELEGRAM_CHAT_ID}
TELEGRAM_PYTHON_LOG_LEVEL=${TELEGRAM_PYTHON_LOG_LEVEL}


# Environment Settings for tests
Expand Down
9 changes: 8 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
logging.basicConfig(level="DEBUG")


class EnvSettings(dict):
def __setitem__(self, key, value):
super().__setitem__(key, value)
logging.info(f"Setting key: {key}, to value {value}")


def sed_inplace(filename, pattern, repl):
"""
Perform the pure-Python equivalent of in-place `sed` substitution: e.g.,
Expand Down Expand Up @@ -133,7 +139,8 @@ async def deploy(request):
logging.debug(f"envFileDst is: {envFileDst}")
shutil.copy(envFileSrc, envFileDst)
# Build envSettings vars
envSettings = {}
envSettings = EnvSettings()
envSettings["FLASK_ENV"] = os.getenv("FLASK_ENV")
envSettings[
"SUBSCRIBIE_REPO_DIRECTORY"
] = f"{os.getenv('SUBSCRIBIE_REPO_DIRECTORY')}"
Expand Down
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

uvicorn --reload main:app --host 0.0.0.0 --port 5001
uvicorn --reload main:app --host 0.0.0.0 --port 8002

0 comments on commit 7207b2a

Please sign in to comment.