diff --git a/backend/src/main/app-resources/default.yml b/backend/src/main/app-resources/default.yml index 5ba247176..9ea447808 100644 --- a/backend/src/main/app-resources/default.yml +++ b/backend/src/main/app-resources/default.yml @@ -24,14 +24,14 @@ ## Only set the installationID if you wish to define the ID used by the beacon. RECOMMENDED: ignore - a default random value will be used ## Only change the urls if instructed or if you wish to redirect for testing (if multiple, separate list with commas ## Only change the productName for testing purposes -## Set the cron time to send the beacon data at a specific time - if unset, the system will send at a random time between 12AM and 4AM once per day +## Set the cron time to send the beacon data at a specific time - if unset, the system will send at a random time between 12AM and 4AM once per day (random preferred) # beacon: # enabled: ture # installationID: [user-defined value] # urls: http://collector.testbed.tier.internet2.edu:5001 # productName: ShibUI # send: -# cron: 0 4 * * * * +# cron: 0 59 3 * * ? # pac4j-enabled: true # pac4j: diff --git a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/configuration/CoreShibUiConfiguration.java b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/configuration/CoreShibUiConfiguration.java index 5bd6d0937..e6b7fee40 100644 --- a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/configuration/CoreShibUiConfiguration.java +++ b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/configuration/CoreShibUiConfiguration.java @@ -45,7 +45,6 @@ import edu.internet2.tier.shibboleth.admin.util.EntityDescriptorConversionUtils; import edu.internet2.tier.shibboleth.admin.util.LuceneUtility; import edu.internet2.tier.shibboleth.admin.util.ModelRepresentationConversions; -import jakarta.servlet.http.HttpServletRequest; import lombok.extern.slf4j.Slf4j; import net.javacrumbs.shedlock.core.LockProvider; import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider; @@ -277,7 +276,7 @@ public LockProvider lockProvider(DataSource dataSource) { } @Bean - public String getBeaconCronValue(BeaconConfigurationRepository repo) + public String getBeaconCronValue(BeaconConfigurationRepository repo, @Value("${shibui.beacon.send.cron:nodefault}") String valueFromConfig) { Optional obc = repo.findById(1); BeaconConfiguration bc; @@ -286,8 +285,16 @@ public String getBeaconCronValue(BeaconConfigurationRepository repo) BeaconConfiguration newbc = new BeaconConfiguration(); Random rand = new Random(); String cron = "0 " + rand.nextInt(60) + " " + rand.nextInt(4) + " * * ?"; + if (valueFromConfig.endsWith("?")) { + cron = valueFromConfig; + } newbc.setSendCron(cron); - repo.save(newbc); + try { + repo.save(newbc); + } + catch(Exception e) { + log.debug("Error trying to create new BEACON CRON - should be ok"); + } bc = repo.findById(1).get(); } else { bc = obc.get(); diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 3c4d83008..49487c448 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -125,6 +125,7 @@ shibui.beacon.enabled=true shibui.beacon.productName=ShibUi shibui.beacon.installationID=UNICON-SHIBUI-TESTING shibui.beacon.url=http://collector.testbed.tier.internet2.edu:5001 +#shibui.beacon.send.cron=0 59 3 * * ? ### Swagger/Springdoc patterns springdoc.use-management-port=true @@ -137,5 +138,5 @@ management.server.port=9090 management.endpoints.web.cors.allowed-origins=* management.endpoints.web.cors.allowed-headers=* -### Lucene temp dir location to use -shibui.lucene.dir=/var/tmp/shibui-cache \ No newline at end of file +# When true, this will remove the validUntil attribute for an EntityDescriptor uploaded from XML source, only set to false if you want the XML uploaded as is +# shibui.remove.EntityDescriptor.validUntil=true \ No newline at end of file