-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from ZhuchkaTriplesix/develop
refactor
- Loading branch information
Showing
16 changed files
with
112 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
TOKEN=telegram.token | ||
POSTGRES_SERVER=db.example.com | ||
POSTGRES_USER=user | ||
POSTGRES_PASSWORD=pass | ||
POSTGRES_DB=app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM python:3.11 | ||
|
||
# Set environment variables | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
# Set working directory in the container | ||
WORKDIR /price_bot | ||
|
||
# Install system dependencies | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
gcc \ | ||
gettext \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Python dependencies | ||
COPY requirements.txt /code/ | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Copy the application code into the container | ||
COPY . /code/ | ||
|
||
# Expose the port the application runs on | ||
EXPOSE 8080 | ||
|
||
# Run the application | ||
CMD ["python", "main.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from typing import Any, Dict, Optional | ||
from dotenv import find_dotenv, load_dotenv | ||
from pydantic_settings import BaseSettings, SettingsConfigDict | ||
from pydantic import PostgresDsn, validator | ||
|
||
load_dotenv(find_dotenv(".env")) | ||
|
||
|
||
class Settings(BaseSettings): | ||
model_config = SettingsConfigDict(case_sensitive=True) | ||
TOKEN: str | ||
POSTGRES_SERVER: str | ||
POSTGRES_USER: str | ||
POSTGRES_PASSWORD: str | ||
POSTGRES_DB: str | ||
SQLALCHEMY_DATABASE_URI: PostgresDsn | None = None | ||
|
||
@validator("SQLALCHEMY_DATABASE_URI", pre=True) | ||
def assemble_db_connection(cls, v: Optional[str], values: Dict[str, Any]) -> Any: | ||
if isinstance(v, str): | ||
return v | ||
return PostgresDsn.build( | ||
scheme="postgresql+pg8000", | ||
username=values.get("POSTGRES_USER"), | ||
password=values.get("POSTGRES_PASSWORD"), | ||
host=values.get("POSTGRES_SERVER"), | ||
path=values.get("POSTGRES_DB"), | ||
) | ||
|
||
|
||
settings = Settings() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: '3.8' | ||
|
||
services: | ||
postgres: | ||
image: postgres:latest | ||
restart: always | ||
|
||
bot: | ||
build: . | ||
restart: always | ||
depends_on: | ||
- postgres | ||
volumes: | ||
- .:/price_bot | ||
ports: | ||
- "8080:8080" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
aiogram~=3.6.0 | ||
pg8000~=1.31.2 | ||
SQLAlchemy~=2.0.30 | ||
python-dotenv~=1.0.1 | ||
pydantic-settings | ||
pydantic~=2.7.1 | ||
steammarket~=0.2.7 |
This file was deleted.
Oops, something went wrong.