remove sensitive logs
This commit is contained in:
8
lib.py
8
lib.py
@@ -39,12 +39,9 @@ def get_credentials():
|
|||||||
# Try to load credentials from JSON content directly
|
# Try to load credentials from JSON content directly
|
||||||
credentials_json = os.getenv("GOOGLE_CREDENTIALS_JSON")
|
credentials_json = os.getenv("GOOGLE_CREDENTIALS_JSON")
|
||||||
|
|
||||||
logger.info(f"creds JSON: {credentials_json}")
|
|
||||||
|
|
||||||
if credentials_json:
|
if credentials_json:
|
||||||
try:
|
try:
|
||||||
credentials_info = json.loads(credentials_json)
|
credentials_info = json.loads(credentials_json)
|
||||||
logger.info(f"creds JSON parsed: {credentials_info}")
|
|
||||||
project_id = credentials_info.get("project_id")
|
project_id = credentials_info.get("project_id")
|
||||||
|
|
||||||
credentials = service_account.Credentials.from_service_account_info(
|
credentials = service_account.Credentials.from_service_account_info(
|
||||||
@@ -57,8 +54,6 @@ def get_credentials():
|
|||||||
# Fall back to file-based credentials (standard behavior)
|
# Fall back to file-based credentials (standard behavior)
|
||||||
credentials_path = os.getenv("GOOGLE_APPLICATION_CREDENTIALS")
|
credentials_path = os.getenv("GOOGLE_APPLICATION_CREDENTIALS")
|
||||||
|
|
||||||
logger.info(f"creds path: {credentials_path}")
|
|
||||||
|
|
||||||
if credentials_path and os.path.exists(credentials_path):
|
if credentials_path and os.path.exists(credentials_path):
|
||||||
with open(credentials_path) as f:
|
with open(credentials_path) as f:
|
||||||
credentials_info = json.load(f)
|
credentials_info = json.load(f)
|
||||||
@@ -102,9 +97,6 @@ async def generate(prompt: str):
|
|||||||
try:
|
try:
|
||||||
credentials, project_id = get_credentials()
|
credentials, project_id = get_credentials()
|
||||||
|
|
||||||
logger.info(f"credentials: {credentials}")
|
|
||||||
logger.info(f"project_id: {project_id}")
|
|
||||||
|
|
||||||
client = genai.Client(
|
client = genai.Client(
|
||||||
vertexai=True,
|
vertexai=True,
|
||||||
credentials=credentials,
|
credentials=credentials,
|
||||||
|
|||||||
Reference in New Issue
Block a user