-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
2,304 additions
and
381 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
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,39 @@ | ||
version: '3.8' | ||
|
||
services: | ||
backend: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- "8000:8000" | ||
environment: | ||
- DATABASE_URL=postgresql://user:password@db:5432/neonadeuli | ||
volumes: | ||
- .:/app/backend | ||
depends_on: | ||
- db | ||
|
||
|
||
db: | ||
postgresql: | ||
container_name: neonadeuli-postgresql | ||
image: postgres:13 | ||
restart: unless-stopped | ||
environment: | ||
- POSTGRES_DB=neonadeuli | ||
- POSTGRES_USER=root | ||
- POSTGRES_PASSWORD=1234 | ||
ports: | ||
- "5432:5432" | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U root -d neonadeuli"] | ||
interval: 10s | ||
timeout: 4s | ||
retries: 5 | ||
start_period: 30s | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
|
||
sonarqube: | ||
image: sonarqube:latest | ||
redis: | ||
container_name: neonadeuli-redis | ||
image: redis:latest | ||
restart: always | ||
ports: | ||
- "9000:9000" | ||
environment: | ||
- SONAR_JDBC_URL=jdbc:postgresql://sonarqube_db:5432/sonar | ||
- SONAR_JDBC_USERNAME=sonar | ||
- SONAR_JDBC_PASSWORD=sonar | ||
volumes: | ||
- sonarqube_data:/opt/sonarqube/data | ||
- sonarqube_extensions:/opt/sonarqube/extensions | ||
- sonarqube_logs:/opt/sonarqube/logs | ||
depends_on: | ||
- sonarqube_db | ||
|
||
sonarqube_db: | ||
image: postgres:13 | ||
environment: | ||
- POSTGRES_DB=sonar | ||
- POSTGRES_USER=sonar | ||
- POSTGRES_PASSWORD=sonar | ||
- "6379:6379" | ||
volumes: | ||
- sonarqube_db_data:/var/lib/postgresql/data | ||
- redis_data:/data | ||
healthcheck: | ||
test: ["CMD", "redis-cli", "ping"] | ||
interval: 5s | ||
timeout: 3s | ||
retries: 5 | ||
|
||
volumes: | ||
postgres_data: | ||
sonarqube_data: | ||
sonarqube_extensions: | ||
sonarqube_logs: | ||
sonarqube_db_data: | ||
redis_data: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
[tool.poetry] | ||
name = "너나들이" | ||
packages = [ | ||
{ include = "neonadeuli", from = "src" }, | ||
version = "0.3.3" | ||
description = "대화형 챗봇 AI와 다양한 콘텐츠로 한국의 국가 유산과 역사를 재미있게 탐구하는 문화 콘텐츠 서비스" | ||
authors = ["정종현 <[email protected]>", "김강현 <[email protected]>"] | ||
authors = ["정종현 <[email protected]>"] | ||
|
||
[tool.pytest.ini_options] | ||
pythonpath = [ | ||
"src" | ||
] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.12" | ||
|
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,3 @@ | ||
[pytest] | ||
testpaths = src/test | ||
pythonpath = src/main |
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 |
---|---|---|
|
@@ -25,4 +25,8 @@ flake8-comprehensions | |
flake8-pytest-style | ||
isort | ||
mypy | ||
groq | ||
authlib | ||
email-validator >= 2.0 | ||
sphinx | ||
groq | ||
redis |
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 |
---|---|---|
@@ -1,38 +1,6 @@ | ||
from fastapi import Depends, HTTPException, status | ||
from fastapi.security import OAuth2PasswordBearer | ||
from sqlalchemy.orm import Session | ||
from jose import jwt, JWTError | ||
def get_pagination_params(skip: int=0, limit: int=100): | ||
return {"skip": skip, "limit": limit} | ||
|
||
from src.main.core.config import settings | ||
from src.main.db.deps import get_db | ||
from src.main.domains.user.services import UserService | ||
from src.main.domains.user.models.user import User | ||
|
||
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token") | ||
|
||
async def get_current_user( | ||
db: Session = Depends(get_db), | ||
token: str = Depends(oauth2_scheme) | ||
) -> User: | ||
credentials_exception = HTTPException( | ||
status_code=status.HTTP_401_UNAUTHORIZED, | ||
details="자격 증명을 검증할 수 없습니다.", | ||
headers={"WWW-Authenticate":"Bearer"}, | ||
) | ||
try: | ||
payload = jwt.decode( | ||
token, settings.SECRET_KEY, algorithm=[settings.ALGORITHM] | ||
) | ||
username: str = payload.get("sub") | ||
if username is None: | ||
raise credentials_exception | ||
except JWTError: | ||
raise credentials_exception | ||
|
||
user_service = UserService(db) | ||
user = user_service.get_user_by_name(username) | ||
if user is None: | ||
raise credentials_exception | ||
return user | ||
|
||
|
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,10 @@ | ||
""" | ||
인증 관련 기능을 제공하는 패키지입니다. | ||
JWT 토큰 처리, OAuth 인증, 그리고 사용자 인증을 위한 의존성 함수를 포함합니다. | ||
""" | ||
|
||
from .jwt import create_access_token, verify_token | ||
from .oauth import setup_oauth | ||
|
||
__all__ = ['create_access_token', 'verify_token', 'setup_oauth'] |
Oops, something went wrong.