Skip to content

Commit

Permalink
BXC-4691 add boxctron service key path
Browse files Browse the repository at this point in the history
  • Loading branch information
sharonluong committed Dec 4, 2024
1 parent 507a7e3 commit 4ceb7e0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
public class ChompbPreIngestService {
private GlobalPermissionEvaluator globalPermissionEvaluator;
private Path baseProjectsPath;
private String serviceKeyPath;
private static final Set<String> VALID_FILENAMES = Set.of("data.json", "data.csv");

/**
Expand All @@ -41,6 +42,7 @@ public String startCropping(AgentPrincipals agent, String projectName, String em
return executeChompbCommand("chompb", "process_source_files",
"--action", "velocicroptor",
"-w", baseProjectsPath.resolve(projectName).toAbsolutePath().toString(),
"-k", serviceKeyPath,
"--user", agent.getUsername(),
"--email", email);
}
Expand Down Expand Up @@ -124,4 +126,8 @@ public void setGlobalPermissionEvaluator(GlobalPermissionEvaluator globalPermiss
public void setBaseProjectsPath(Path baseProjectsPath) {
this.baseProjectsPath = baseProjectsPath;
}

public void setServiceKeyPath(String serviceKeyPath) {
this.serviceKeyPath = serviceKeyPath;
}
}
1 change: 1 addition & 0 deletions web-admin-app/src/main/webapp/WEB-INF/service-context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<bean id="chompbPreIngestService" class="edu.unc.lib.boxc.web.admin.controllers.processing.ChompbPreIngestService">
<property name="globalPermissionEvaluator" ref="globalPermissionEvaluator" />
<property name="baseProjectsPath" value="${chompb.projects.basePath}" />
<property name="serviceKeyPath" value="${boxctron.service.key}" />
</bean>

<bean class="edu.unc.lib.boxc.web.common.view.CDRViewResolver" p:suffix=".jsp">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void setup() {
closeable = openMocks(this);
service = new ChompbPreIngestService();
service.setBaseProjectsPath(tmpFolder);
service.setServiceKeyPath("/path/to/key");
service.setGlobalPermissionEvaluator(globalPermissionEvaluator);
when(agentPrincipals.getPrincipals()).thenReturn(new AccessGroupSetImpl("group"));
when(globalPermissionEvaluator.hasGlobalPermission(any(AccessGroupSet.class), eq(Permission.ingest))).thenReturn(true);
Expand Down

0 comments on commit 4ceb7e0

Please sign in to comment.