Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pydantic-settings as a dependency #57

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ install_requires =
gunicorn
httpx
itsdangerous
pydantic-settings
python-dotenv
teuthology @ git+https://github.com/ceph/teuthology#egg=teuthology[test]

Expand Down
43 changes: 0 additions & 43 deletions src/teuthology_api/config.py

This file was deleted.

11 changes: 6 additions & 5 deletions src/teuthology_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
import os
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
from dotenv import load_dotenv
from starlette.middleware.sessions import SessionMiddleware

from teuthology_api.config import settings
from teuthology_api.routes import suite, kill, login, logout

load_dotenv()

DEPLOYMENT = settings.deployment
SESSION_SECRET_KEY = settings.session_secret_key
PULPITO_URL = settings.pulpito_url
PADDLES_URL = settings.paddles_url
DEPLOYMENT = os.getenv("DEPLOYMENT")
SESSION_SECRET_KEY = os.getenv("SESSION_SECRET_KEY")
PULPITO_URL = os.getenv("PULPITO_URL")
PADDLES_URL = os.getenv("PADDLES_URL")

log = logging.getLogger(__name__)
app = FastAPI()
Expand Down
15 changes: 8 additions & 7 deletions src/teuthology_api/routes/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
import os
from fastapi import APIRouter, HTTPException, Request
from fastapi.responses import RedirectResponse
from dotenv import load_dotenv
import httpx
from teuthology_api.config import settings

load_dotenv()

GH_CLIENT_ID = settings.gh_client_id
GH_CLIENT_SECRET = settings.gh_client_secret
GH_AUTHORIZATION_BASE_URL = settings.gh_authorization_base_url
GH_TOKEN_URL = settings.gh_token_url
GH_FETCH_MEMBERSHIP_URL = settings.gh_fetch_membership_url
PULPITO_URL = settings.pulpito_url
GH_CLIENT_ID = os.getenv("GH_CLIENT_ID")
GH_CLIENT_SECRET = os.getenv("GH_CLIENT_SECRET")
GH_AUTHORIZATION_BASE_URL = os.getenv("GH_AUTHORIZATION_BASE_URL")
GH_TOKEN_URL = os.getenv("GH_TOKEN_URL")
GH_FETCH_MEMBERSHIP_URL = os.getenv("GH_FETCH_MEMBERSHIP_URL")
PULPITO_URL = os.getenv("PULPITO_URL")

log = logging.getLogger(__name__)
router = APIRouter(
Expand Down
4 changes: 2 additions & 2 deletions src/teuthology_api/routes/logout.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import logging
import os
from fastapi import APIRouter, HTTPException, Request
from fastapi.responses import RedirectResponse
from teuthology_api.config import settings

PULPITO_URL = settings.pulpito_url
PULPITO_URL = os.getenv("PULPITO_URL")
log = logging.getLogger(__name__)

router = APIRouter(
Expand Down
9 changes: 5 additions & 4 deletions src/teuthology_api/services/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
from pathlib import Path

from fastapi import HTTPException, Request

from teuthology_api.config import settings
from dotenv import load_dotenv

import teuthology
import requests # Note: import requests after teuthology
from requests.exceptions import HTTPError

PADDLES_URL = settings.paddles_url
ARCHIVE_DIR = settings.archive_dir
load_dotenv()

PADDLES_URL = os.getenv("PADDLES_URL")
ARCHIVE_DIR = os.getenv("ARCHIVE_DIR")

log = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions src/teuthology_api/services/kill.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import logging
import os
import subprocess

from fastapi import HTTPException, Request

from teuthology_api.config import settings
from teuthology_api.services.helpers import get_username, get_run_details


TEUTHOLOGY_PATH = settings.teuthology_path
TEUTHOLOGY_PATH = os.getenv("TEUTHOLOGY_PATH")
log = logging.getLogger(__name__)


Expand Down
Loading