Skip to content

Commit

Permalink
config
Browse files Browse the repository at this point in the history
  • Loading branch information
azliu0 committed Apr 14, 2024
1 parent 50df806 commit 89fe152
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions server/config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
"""Configuration for backend server."""

import os
from pathlib import Path
from dotenv import load_dotenv
from typing import cast

from dotenv import load_dotenv

load_dotenv(os.path.dirname(__file__) / Path("../.env"))

OpenAIMessage = dict[str, str]
Expand All @@ -27,6 +30,9 @@ def _get_config_option(
if required and value is None:
raise Exception(f"Environment variable {name} is required but not set.")

if required:
value = cast(str, value)

return value


Expand All @@ -40,8 +46,8 @@ def _get_config_option(

FLASK_RUN_PORT = 2010
DEBUG = True
MAIL_USERNAME = cast(str, _get_config_option("MAIL_USERNAME", required=True))
MAIL_PASSWORD = cast(str, _get_config_option("MAIL_PASSWORD", required=True))
MAIL_USERNAME = _get_config_option("MAIL_USERNAME", required=True)
MAIL_PASSWORD = _get_config_option("MAIL_PASSWORD", required=True)
MAIL_CC = _get_config_option("MAIL_CC", required=True)

MAIL_SENDER_TAG = f'"Blueprint Team" <{MAIL_USERNAME}>'
Expand Down

0 comments on commit 89fe152

Please sign in to comment.