Skip to content

Commit

Permalink
Allow user override through AYON_USERNAME.
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-ynput committed Oct 28, 2024
1 parent c4f6942 commit 06f1580
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions client/ayon_traypublisher/addon.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os

from pathlib import Path

import ayon_api

from ayon_core.lib import get_ayon_launcher_args
from ayon_core.lib.execute import run_detached_process
from ayon_core.addon import (
Expand Down Expand Up @@ -109,6 +112,13 @@ def ingestcsv(
"""
from .csv_publish import csvpublish

# Allow user override through AYON_USERNAME when
# current connection is made through a service user.
username = os.environ.get("AYON_USERNAME")
con = ayon_api.get_server_api_connection()
if username and con.is_service_user():
con.set_default_service_username(username)

# use Path to check if csv_filepath exists
if not Path(filepath).exists():
raise FileNotFoundError(f"File {filepath} does not exist.")
Expand Down

0 comments on commit 06f1580

Please sign in to comment.