Skip to content

Commit

Permalink
Add support for ecs member tenants
Browse files Browse the repository at this point in the history
  • Loading branch information
bltravis authored and btravisebsco committed Sep 11, 2024
1 parent 285f902 commit 3c1ee68
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/folio_data_import/MARCDataImport.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,12 @@ async def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--gateway_url", type=str, help="The FOLIO API Gateway URL")
parser.add_argument("--tenant_id", type=str, help="The FOLIO tenant ID")
parser.add_argument(
"--member_tenant_id",
type=str,
help="The FOLIO ECS member tenant ID (if applicable)",
default="",
)
parser.add_argument("--username", type=str, help="The FOLIO username")
parser.add_argument("--password", type=str, help="The FOLIO password", default="")
parser.add_argument(
Expand Down Expand Up @@ -480,6 +486,11 @@ async def main() -> None:
folio_client = folioclient.FolioClient(
args.gateway_url, args.tenant_id, args.username, args.password
)

# Set the member tenant id if provided to support FOLIO ECS multi-tenant environments
if args.member_tenant_id:
folio_client.okapi_headers["x-okapi-tenant"] = args.member_tenant_id

if not args.import_profile_name:
import_profiles = folio_client.folio_get(
"/data-import-profiles/jobProfiles",
Expand Down
14 changes: 13 additions & 1 deletion src/folio_data_import/UserImport.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,11 @@ async def main() -> None:
"""
parser = argparse.ArgumentParser()
parser.add_argument("--tenant_id", help="The tenant id")
parser.add_argument(
"--member_tenant_id",
help="The FOLIO ECS member tenant id (if applicable)",
default="",
)
parser.add_argument("--library_name", help="The name of the library")
parser.add_argument("--username", help="The FOLIO username")
parser.add_argument("--okapi_url", help="The Okapi URL")
Expand Down Expand Up @@ -672,8 +677,15 @@ async def main() -> None:
args.username,
args.folio_password
or os.environ.get("FOLIO_PASS", "")
or getpass.getpass("Enter your FOLIO password: "),
or getpass.getpass(
"Enter your FOLIO password: ",
),
)

# Set the member tenant id if provided to support FOLIO ECS multi-tenant environments
if args.member_tenant_id:
folio_client.okapi_headers["x-okapi-tenant"] = args.member_tenant_id

user_file_path = Path(args.user_file_path)
log_file_path = (
user_file_path.parent.parent
Expand Down

0 comments on commit 3c1ee68

Please sign in to comment.