Skip to content

Commit

Permalink
fix: db url
Browse files Browse the repository at this point in the history
  • Loading branch information
erfjab committed Oct 11, 2024
1 parent 03917bf commit 8f4e8ed
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
3 changes: 1 addition & 2 deletions db/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
from sqlalchemy.engine import Connection
from sqlalchemy.ext.asyncio import async_engine_from_config

from utils.config import SQLALCHEMY_DATABASE_URL
from db.base import Base

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
config.set_main_option("sqlalchemy.url", SQLALCHEMY_DATABASE_URL)
config.set_main_option("sqlalchemy.url", "sqlite+aiosqlite:///data/db.sqlite3")
# Interpret the config file for Python logging.
# This line sets up loggers basically.
if config.config_file_name is not None:
Expand Down
4 changes: 1 addition & 3 deletions db/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
from sqlalchemy.ext.asyncio import AsyncAttrs, AsyncSession, create_async_engine
from sqlalchemy.orm import DeclarativeBase, sessionmaker

from utils import config


# Create an asynchronous engine
engine = create_async_engine(
config.SQLALCHEMY_DATABASE_URL,
"sqlite+aiosqlite:///data/db.sqlite3",
connect_args={"check_same_thread": False},
echo=False,
)
Expand Down
4 changes: 0 additions & 4 deletions utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ def require_setting(setting_name, value):
) # required
require_setting("TELEGRAM_ADMINS_ID", TELEGRAM_ADMINS_ID)

SQLALCHEMY_DATABASE_URL = config(
"SQLALCHEMY_DATABASE_URL", default="sqlite+aiosqlite:///data/db.sqlite3", cast=str
)

# Marzban Panel Settings
MARZBAN_USERNAME = config("MARZBAN_USERNAME", default="", cast=str) # required
require_setting("MARZBAN_USERNAME", MARZBAN_USERNAME)
Expand Down

0 comments on commit 8f4e8ed

Please sign in to comment.