Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,13 @@ This application requires a Java 11+ JVM and standard library to run, plus a Jav
Wildfly must be pre-configured before the first deployment of the app. The [wildfly bash scripts](https://github.com/JeffersonLab/wildfly#configure) can be used to accomplish this. See the [Dockerfile](https://github.com/JeffersonLab/jam/blob/main/Dockerfile) for an example.

### Runtime
Uses the [Smoothness Environment Variables](https://github.com/JeffersonLab/smoothness#global-runtime) plus the following application specific:
Uses the [Smoothness Environment Variables](https://github.com/JeffersonLab/smoothness#global-runtime) plus the following application specific Settings:

| Name | Description |
|-----------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| JAM_EMAIL_SENDER | Sender (and from address) of emails. Defaults to `jam@jlab.org` |
| JAM_COMPONENT_DETAIL_URL | URL for Component detail linking. Example: https://ace.jlab.org/srm/reports/component?name= |
| JAM_COMPONENT_QUERY_URL | URL for Component search. Proxied. Example: https://ace.jlab.org/srm/data/components |
| JAM_USER_QUERY_URL | URL for User search. Proxied. Example: https://ace.jlab.org/srm/ajax/search-user |
| COMPONENT_DETAIL_URL | URL for Component detail linking. Example: https://ace.jlab.org/srm/reports/component?name= |
| COMPONENT_QUERY_URL | URL for Component search. Proxied. Example: https://ace.jlab.org/srm/data/components |
| USER_QUERY_URL | URL for User search. Proxied. Example: https://ace.jlab.org/srm/ajax/search-user |

### Database
This application requires an Oracle 18+ database with the following [schema](https://github.com/JeffersonLab/jam/tree/main/container/oracle/initdb.d) installed. The application server hosting this app must also be configured with a JNDI datasource.
Expand Down
1 change: 0 additions & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ services:
JAM_UPCOMING_EXPIRATION_SUBJECT: '[TESTING] Authorization Expired / Expiring Soon'
JAM_EXPIRED_SUBJECT: '[TESTING] Authorization Expired'
JAM_DOWNGRADED_SUBJECT: '[TESTING] Authorization Downgraded'
JAM_EMAIL_SENDER: 'jam@example.com'
KEYCLOAK_REALM: 'test-realm'
KEYCLOAK_RESOURCE: 'jam'
KEYCLOAK_SECRET: 'yHi6W2raPmLvPXoxqMA7VWbLAA2WN0eB'
Expand Down
7 changes: 6 additions & 1 deletion container/oracle/initdb.d/04_settings.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@ insert into SETTING (KEY, VALUE, TYPE, DESCRIPTION, TAG, WEIGHT) values ('HELP_D
insert into SETTING (KEY, VALUE, TYPE, DESCRIPTION, TAG, WEIGHT) values ('EMAIL_ENABLED', 'Y', 'BOOLEAN', 'Emails (including Help/Feedback) enabled', 'EMAIL', 1);
insert into SETTING (KEY, VALUE, TYPE, DESCRIPTION, TAG, WEIGHT) values ('EMAIL_TESTING_ENABLED', 'N', 'BOOLEAN', 'Send all emails to testlead user group', 'EMAIL', 2);
insert into SETTING (KEY, VALUE, TYPE, DESCRIPTION, TAG, WEIGHT) values ('EMAIL_DOMAIN_NAME', '@jlab.org', 'STRING', 'The email domain to append to usernames, starting with and including the ampersat.', 'EMAIL', 3);
insert into SETTING (KEY, VALUE, TYPE, DESCRIPTION, TAG, WEIGHT) values ('EMAIL_SENDER_ADDRESS', 'cnm@jlab.org', 'STRING', 'Email address to use as sender from emails generated in this app. Note: this is not the same as "from".', 'EMAIL', 4);
insert into SETTING (KEY, VALUE, TYPE, DESCRIPTION, TAG, WEIGHT) values ('EMAIL_SENDER_ADDRESS', 'jam@jlab.org', 'STRING', 'Email address to use as sender from emails generated in this app. Note: this is not the same as "from".', 'EMAIL', 4);

-- JAM Specific
insert into SETTING (KEY, VALUE, TYPE, DESCRIPTION, TAG, WEIGHT) values ('USER_QUERY_URL', 'https://ace.jlab.org/srm/ajax/search-user', 'STRING', 'URL to query for users', 'JAM', 1);
insert into SETTING (KEY, VALUE, TYPE, DESCRIPTION, TAG, WEIGHT) values ('COMPONENT_QUERY_URL', 'https://ace.jlab.org/srm/data/components', 'STRING', 'URL to query for components', 'JAM', 2);
insert into SETTING (KEY, VALUE, TYPE, DESCRIPTION, TAG, WEIGHT) values ('COMPONENT_DETAIL_URL', 'https://ace.jlab.org/srm/reports/component?name=', 'STRING', 'URL to link component details', 'JAM', 3);
20 changes: 10 additions & 10 deletions src/main/java/org/jlab/jam/business/session/EmailFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,10 @@ private void sendUpcomingToAdminsAndFacilityManager(FacilityUpcomingExpiration u
try {
EmailService emailService = new EmailService();

String sender = System.getenv("JAM_EMAIL_SENDER");
String sender = SettingsService.cachedSettings.get("EMAIL_SENDER_ADDRESS");

if (sender == null) {
sender = "jam@jlab.org";
throw new RuntimeException("Configure EMAIL_SENDER_ADDRESS Setting in DB");
}

boolean testing = false;
Expand Down Expand Up @@ -406,10 +406,10 @@ public void sendWatcherAuthorizationUpdateEmail(
imagePart.addHeader("Content-Type", "image/png");
multipart.addBodyPart(imagePart);

String sender = System.getenv("JAM_EMAIL_SENDER");
String sender = SettingsService.cachedSettings.get("EMAIL_SENDER_ADDRESS");

if (sender == null) {
sender = "jam@jlab.org";
throw new RuntimeException("Configure EMAIL_SENDER_ADDRESS Setting in DB");
}

String toCsv = "";
Expand Down Expand Up @@ -494,10 +494,10 @@ public void sendAdminAndManagerAuthorizationUpdateEmail(
imagePart.addHeader("Content-Type", "image/png");
multipart.addBodyPart(imagePart);

String sender = System.getenv("JAM_EMAIL_SENDER");
String sender = SettingsService.cachedSettings.get("EMAIL_SENDER_ADDRESS");

if (sender == null) {
sender = "jam@jlab.org";
throw new RuntimeException("Configure EMAIL_SENDER_ADDRESS Setting in DB");
}

String toCsv = IOUtil.toCsv(addressList.toArray());
Expand Down Expand Up @@ -567,10 +567,10 @@ public void sendVerificationTeamsAuthorizationUpdateEmail(
imagePart.addHeader("Content-Type", "image/png");
multipart.addBodyPart(imagePart);

String sender = System.getenv("JAM_EMAIL_SENDER");
String sender = SettingsService.cachedSettings.get("EMAIL_SENDER_ADDRESS");

if (sender == null) {
sender = "jam@jlab.org";
throw new RuntimeException("Configure EMAIL_SENDER_ADDRESS Setting in DB");
}

String toCsv = IOUtil.toCsv(addressList.toArray());
Expand All @@ -595,10 +595,10 @@ private void sendUpcomingToVerificationTeam(Facility facility, TeamUpcoming upco
try {
EmailService emailService = new EmailService();

String sender = System.getenv("JAM_EMAIL_SENDER");
String sender = SettingsService.cachedSettings.get("EMAIL_SENDER_ADDRESS");

if (sender == null) {
sender = "jam@jlab.org";
throw new RuntimeException("Configure EMAIL_SENDER_ADDRESS Setting in DB");
}

String subject = "JAM: " + facility.getName() + " Upcoming Expiration Notice";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jlab.smoothness.business.service.SettingsService;
import org.jlab.smoothness.presentation.util.ParamBuilder;
import org.jlab.smoothness.presentation.util.ServletUtil;

Expand Down Expand Up @@ -44,10 +45,10 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
String q = request.getParameter("q");

// https://ace.jlab.org/srm/data/components
String COMPONENT_QUERY_URL = System.getenv("JAM_COMPONENT_QUERY_URL");
String COMPONENT_QUERY_URL = SettingsService.cachedSettings.get("COMPONENT_QUERY_URL");

if (COMPONENT_QUERY_URL == null) {
throw new ServletException("JAM_COMPONENT_QUERY_URL not set");
throw new ServletException("COMPONENT_QUERY_URL not set");
}

ParamBuilder builder = new ParamBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jlab.smoothness.business.service.SettingsService;
import org.jlab.smoothness.presentation.util.ParamBuilder;
import org.jlab.smoothness.presentation.util.ServletUtil;

Expand Down Expand Up @@ -44,10 +45,10 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
String q = request.getParameter("q");

// https://ace.jlab.org/srm/ajax/search-user
String USER_QUERY_URL = System.getenv("JAM_USER_QUERY_URL");
String USER_QUERY_URL = SettingsService.cachedSettings.get("USER_QUERY_URL");

if (USER_QUERY_URL == null) {
throw new ServletException("JAM_USER_QUERY_URL not set");
throw new ServletException("USER_QUERY_URL not set");
}

ParamBuilder builder = new ParamBuilder();
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/tags/verification-panel.tag
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<span class="small-icon baseline-small-icon not-verified-icon"></span>
</c:otherwise>
</c:choose>
<a href="${env['JAM_COMPONENT_DETAIL_URL']}${fn:escapeXml(component.name)}"><c:out value="${component.name}"/></a>
<a href="${settings.get('COMPONENT_DETAIL_URL')}${fn:escapeXml(component.name)}"><c:out value="${component.name}"/></a>
</div>
</c:forEach>
</td>
Expand Down
Loading