File tree Expand file tree Collapse file tree 3 files changed +9
-11
lines changed
Expand file tree Collapse file tree 3 files changed +9
-11
lines changed Original file line number Diff line number Diff line change 11import hashlib
22import json
33import mimetypes
4+ from functools import lru_cache
45from typing import Any
56
67import starlette .requests
78from api .database import get_async_session , get_engine
89from api .routes .security import has_access
9- from fastapi import (
10- APIRouter ,
11- Depends ,
12- HTTPException ,
13- )
10+ from fastapi import APIRouter , Depends , HTTPException
1411from minio import Minio
15- from sqlalchemy import text
1612from pydantic import Field
1713from pydantic_settings import BaseSettings , SettingsConfigDict
18- from functools import lru_cache
14+ from sqlalchemy import text
1915from starlette .datastructures import UploadFile as StarletteUploadFile
2016
2117
@@ -45,7 +41,6 @@ def get_file_settings() -> FileSettings:
4541 )
4642
4743
48-
4944router = APIRouter (
5045 prefix = "/object" ,
5146 tags = ["file" ],
@@ -93,6 +88,7 @@ def get_storage_host_bucket() -> tuple[str, str]:
9388 Also ensures host has no port (hostname only) if storage_host ever includes one.
9489 """
9590 import urllib .parse
91+
9692 settings = get_file_settings ()
9793
9894 raw_host = settings .s3_endpoint
Original file line number Diff line number Diff line change @@ -358,7 +358,7 @@ async def redirect_callback(code: str, state: Optional[str] = None):
358358 )
359359
360360 # validate jwt https://dev.macrostrat.org/dev/me
361- #TODO remove the groups and sub and add the user_name
361+ # TODO remove the groups and sub and add the user_name
362362 access_token = create_access_token (
363363 data = {
364364 "sub" : user .sub ,
@@ -398,7 +398,7 @@ async def redirect_callback(code: str, state: Optional[str] = None):
398398 samesite = samesite ,
399399 secure = secure ,
400400 )
401- #TODO remove the token type
401+ # TODO remove the token type
402402 refresh_jwt = jwt .encode (
403403 {
404404 "user_id" : user .id ,
@@ -464,7 +464,7 @@ async def refresh_token(
464464 else "web_user"
465465 )
466466 # setting new access cookie
467- #TODO can remove groups, sub. add user_name.
467+ # TODO can remove groups, sub. add user_name.
468468 access_token = create_access_token (
469469 data = {"sub" : user .sub , "role" : role , "user_id" : user .id , "groups" : list (ids )}
470470 )
Original file line number Diff line number Diff line change 11from pydantic import Field
22from pydantic_settings import BaseSettings , SettingsConfigDict
33
4+
45class Settings (BaseSettings ):
56 model_config = SettingsConfigDict (
67 env_file = ".env" ,
@@ -21,4 +22,5 @@ class Settings(BaseSettings):
2122 jwt_secret_key : str = Field (alias = "SECRET_KEY" )
2223 jwt_algorithm : str = Field (default = "HS256" , alias = "JWT_ENCRYPTION_ALGORITHM" )
2324
25+
2426settings = Settings ()
You can’t perform that action at this time.
0 commit comments