feat: Allow setting port as PORT env var
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
This seems important for render hosting, as described in https://render.com/docs/web-services#port-binding.
This commit is contained in:
parent
2da0b90b1b
commit
4ef2ce14d6
2 changed files with 14 additions and 1 deletions
|
|
@ -8,6 +8,16 @@ from dotenv import load_dotenv
|
|||
_ = load_dotenv()
|
||||
|
||||
|
||||
@dataclass
|
||||
class AppConfig:
|
||||
PORT: int
|
||||
|
||||
@classmethod
|
||||
def from_env(cls) -> "AppConfig":
|
||||
PORT = os.getenv("PORT", "8000")
|
||||
return cls(PORT=int(PORT))
|
||||
|
||||
|
||||
@dataclass
|
||||
class AiConfig:
|
||||
API_KEY: str
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue