16 lines
440 B
Python
16 lines
440 B
Python
"""Gitea token-based authentication."""
|
|
from agent.encryption import encrypt_token
|
|
|
|
|
|
async def get_gitea_token() -> str:
|
|
import os
|
|
return os.environ.get("GITEA_TOKEN", "")
|
|
|
|
|
|
async def get_encrypted_gitea_token() -> tuple[str, str]:
|
|
import os
|
|
token = os.environ.get("GITEA_TOKEN", "")
|
|
fernet_key = os.environ.get("FERNET_KEY", "")
|
|
encrypted = encrypt_token(token) if fernet_key else token
|
|
return token, encrypted
|