Skip to content

Commit

Permalink
Merge pull request #2 from DesignSafe-CI/add-nees-system
Browse files Browse the repository at this point in the history
Allow downloads from the nees.public system.
  • Loading branch information
jarosenb authored Jan 31, 2022
2 parents a52b8fa + 27acc6d commit 348f6e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def get_system_root(system: str) -> str:
root_dir = "/corral-repl/tacc/NHERI/community"
case "designsafe.storage.published":
root_dir = "/corral-repl/tacc/NHERI/published"
case "nees.public":
root_dir = "/corral-repl/tacc/NHERI/public/projects"
case prj_system if system.startswith("project-"):
project_id = prj_system.split("-", 1)[1]
root_dir = os.path.join("/corral-repl/tacc/NHERI/projects", project_id)
Expand All @@ -62,7 +64,6 @@ def walk_archive_paths(base_path: str, file_paths: List[str]) -> List[Archive]:
size = 0
for file in file_paths:
full_path = base / file.strip("/")
print(full_path)

if full_path.is_file():
zip_paths.append({"fs": str(full_path), "n": full_path.name})
Expand Down Expand Up @@ -121,7 +122,11 @@ def check_downloadable(
request: CheckRequest,
auth: http.HTTPAuthorizationCredentials = Depends(HTTPBearer(auto_error=False)),
):
PUBLIC_SYSTEMS = ["designsafe.storage.community", "designsafe.storage.published"]
PUBLIC_SYSTEMS = [
"designsafe.storage.community",
"designsafe.storage.published",
"nees.public",
]
if not auth and request.system not in PUBLIC_SYSTEMS:
raise HTTPException(
status_code=401,
Expand Down
1 change: 1 addition & 0 deletions server/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def test_get_system_root():
get_system_root("designsafe.storage.published")
== "/corral-repl/tacc/NHERI/published"
)
assert get_system_root("nees.public") == "/corral-repl/tacc/NHERI/public/projects"
assert (
get_system_root("project-7448086614930166251-242ac113-0001-012")
== "/corral-repl/tacc/NHERI/projects/7448086614930166251-242ac113-0001-012"
Expand Down

0 comments on commit 348f6e4

Please sign in to comment.