refactor: reorganize the whole project layout
Build and Push to Registry / build (push) Successful in 8s
Build and Push to Registry / build (push) Successful in 8s
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
from datetime import UTC, datetime
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Response, status
|
||||
|
||||
from core.security import (
|
||||
AuthContext,
|
||||
create_access_token,
|
||||
get_auth_context,
|
||||
verify_password,
|
||||
)
|
||||
from db.auth import get_user_by_username, revoke_token
|
||||
from fastapi import APIRouter, Depends, HTTPException, Response, status
|
||||
from models.auth import LoginInput, TokenResponse
|
||||
from repositories.auth import get_user_by_username, revoke_token
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/auth",
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
|
||||
from core.security import require_authenticated_user
|
||||
from db.proxy import (
|
||||
from models.proxy import ProxyCreateInput, ProxyUpdateInput
|
||||
from repositories.proxy import (
|
||||
create_proxy,
|
||||
delete_proxy,
|
||||
get_proxy_by_port,
|
||||
update_proxy,
|
||||
)
|
||||
from db.proxy import (
|
||||
from repositories.proxy import (
|
||||
list_proxies as list_proxy_documents,
|
||||
)
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from models.proxy import ProxyCreateInput, ProxyUpdateInput
|
||||
from utils.proxy.validator import ProxyCodeValidationError, validate_proxy_code
|
||||
from services.proxy.validator import ProxyCodeValidationError, validate_proxy_code
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/proxy",
|
||||
|
||||
@@ -5,13 +5,14 @@ from uuid import uuid4
|
||||
|
||||
from authlib.jose import jwt # type: ignore
|
||||
from authlib.jose.errors import JoseError # type: ignore
|
||||
from core.config import settings
|
||||
from db.auth import get_user_by_username, is_token_revoked
|
||||
from fastapi import Depends, HTTPException, status
|
||||
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
|
||||
from models.auth import AccessTokenPayload, AuthUserDocument
|
||||
from passlib.context import CryptContext
|
||||
|
||||
from core.config import settings
|
||||
from models.auth import AccessTokenPayload, AuthUserDocument
|
||||
from repositories.auth import get_user_by_username, is_token_revoked
|
||||
|
||||
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
||||
bearer_scheme = HTTPBearer(auto_error=False)
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from utils.docker.compose import (
|
||||
from integrations.docker.compose import (
|
||||
find_docker_compose,
|
||||
get_all_services,
|
||||
get_services,
|
||||
get_visible_folders,
|
||||
)
|
||||
from utils.docker.editor import change_port
|
||||
from utils.docker.models import DockerService
|
||||
from integrations.docker.editor import change_port
|
||||
from integrations.docker.models import DockerService
|
||||
|
||||
__all__ = [
|
||||
"DockerService",
|
||||
@@ -2,8 +2,8 @@ from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
from utils.docker.models import DockerService
|
||||
from utils.docker.ports import _get_service_port
|
||||
from integrations.docker.models import DockerService
|
||||
from integrations.docker.ports import _get_service_port
|
||||
|
||||
COMPOSE_NAMES = (
|
||||
"compose.yml",
|
||||
@@ -2,8 +2,8 @@ from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
from utils.docker.compose import find_docker_compose
|
||||
from utils.docker.ports import _get_port_index, _replace_port_in_mapping
|
||||
from integrations.docker.compose import find_docker_compose
|
||||
from integrations.docker.ports import _get_port_index, _replace_port_in_mapping
|
||||
|
||||
|
||||
def _backup_path_for(compose_path: Path) -> Path:
|
||||
+4
-3
@@ -1,14 +1,15 @@
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
from api.auth.router import router as auth_router
|
||||
from api.proxy.router import router as proxy_router
|
||||
from core.config import settings
|
||||
from core.mongodb import close_mongodb, init_mongodb
|
||||
from core.redis import close_redis, init_redis
|
||||
from core.security import hash_password
|
||||
from db.auth import ensure_auth_indexes, ensure_single_account
|
||||
from db.proxy import ensure_proxy_indexes
|
||||
from fastapi import FastAPI
|
||||
from repositories.auth import ensure_auth_indexes, ensure_single_account
|
||||
from repositories.proxy import ensure_proxy_indexes
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
|
||||
@@ -2,9 +2,10 @@ from collections.abc import Mapping
|
||||
from datetime import UTC, datetime
|
||||
from typing import Any
|
||||
|
||||
from motor.motor_asyncio import AsyncIOMotorCollection
|
||||
|
||||
from core.mongodb import get_database
|
||||
from models.auth import AuthUserDocument
|
||||
from motor.motor_asyncio import AsyncIOMotorCollection
|
||||
|
||||
USERS_COLLECTION_NAME = "auth_users"
|
||||
REVOKED_COLLECTION_NAME = "revoked_tokens"
|
||||
@@ -2,12 +2,13 @@ from collections.abc import Mapping
|
||||
from datetime import UTC, datetime
|
||||
from typing import Any
|
||||
|
||||
from motor.motor_asyncio import AsyncIOMotorCollection
|
||||
from pymongo import ReturnDocument
|
||||
from services.proxy.models import ServiceConfig
|
||||
|
||||
from core.mongodb import get_database
|
||||
from models.proxy import ProxyDocument, ProxyUpdateInput
|
||||
from models.service import ServiceEndpointDocument
|
||||
from motor.motor_asyncio import AsyncIOMotorCollection
|
||||
from pymongo import ReturnDocument
|
||||
from utils.proxy.types import ServiceConfig
|
||||
|
||||
COLLECTION_NAME = "proxies"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from utils.proxy.types import ServiceConfig
|
||||
from services.proxy.models import ServiceConfig
|
||||
|
||||
|
||||
async def create_proxy(
|
||||
Reference in New Issue
Block a user