Skip to content

Commit

Permalink
added storage client to ApplicationAdapter as a field and update the …
Browse files Browse the repository at this point in the history
…storage client values
  • Loading branch information
cemklc committed Apr 8, 2021
1 parent 5be5e79 commit 18082db
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions src/main/java/io/antmedia/AntMediaApplicationAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.Set;
import java.util.regex.Pattern;

import io.antmedia.storage.StorageClient;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.http.HttpEntity;
Expand Down Expand Up @@ -129,8 +130,8 @@ public class AntMediaApplicationAdapter implements IAntMediaStreamHandler, IShut
protected WebRTCVideoReceiveStats webRTCVideoReceiveStats = new WebRTCVideoReceiveStats();

protected WebRTCAudioReceiveStats webRTCAudioReceiveStats = new WebRTCAudioReceiveStats();


protected WebRTCVideoSendStats webRTCVideoSendStats = new WebRTCVideoSendStats();

protected WebRTCAudioSendStats webRTCAudioSendStats = new WebRTCAudioSendStats();
Expand All @@ -139,10 +140,15 @@ public class AntMediaApplicationAdapter implements IAntMediaStreamHandler, IShut

protected boolean serverShuttingDown = false;

private StorageClient storageClient;


public boolean appStart(IScope app) {
setScope(app);
vertx = (Vertx) app.getContext().getBean(VERTX_BEAN_NAME);

storageClient = (StorageClient) app.getContext().getBean(StorageClient.BEAN_NAME);

//initalize to access the data store directly in the code
getDataStore();

Expand Down Expand Up @@ -223,6 +229,11 @@ else if (socialEndpointCredentials.getServiceName().equals(YOUTUBE))
webRTCAdaptor.setPacketLossDiffThresholdForSwitchback(appSettings.getPacketLossDiffThresholdForSwitchback());
webRTCAdaptor.setRttMeasurementDiffThresholdForSwitchback(appSettings.getRttMeasurementDiffThresholdForSwitchback());
}

storageClient.setStorageName(appSettings.getS3BucketName());
storageClient.setRegion(appSettings.getS3RegionName());
storageClient.setAccessKey(appSettings.getS3AccessKey());
storageClient.setSecretKey(appSettings.getS3SecretKey());
logger.info("{} started", app.getName());

return true;
Expand Down Expand Up @@ -1423,7 +1434,7 @@ private boolean updateAppSettingsFile(String appName, AppSettings newAppsettings


private void updateAppSettingsBean(AppSettings appSettings, AppSettings newSettings)
{
{
appSettings.setMp4MuxingEnabled(newSettings.isMp4MuxingEnabled());
appSettings.setWebMMuxingEnabled(newSettings.isWebMMuxingEnabled());
appSettings.setAddDateTimeToMp4FileName(newSettings.isAddDateTimeToMp4FileName());
Expand Down Expand Up @@ -1483,15 +1494,25 @@ private void updateAppSettingsBean(AppSettings appSettings, AppSettings newSetti
appSettings.setS3BucketName(newSettings.getS3BucketName());
appSettings.setS3RegionName(newSettings.getS3RegionName());

storageClient.setStorageName(newSettings.getS3BucketName());
storageClient.setAccessKey(newSettings.getS3AccessKey());
storageClient.setSecretKey(newSettings.getS3SecretKey());
storageClient.setRegion(newSettings.getS3RegionName());

if (!appSettings.isS3RecordingEnabled()) {
appSettings.setS3AccessKey("");
appSettings.setS3SecretKey("");
appSettings.setS3BucketName("");
appSettings.setS3RegionName("");

storageClient.setStorageName("");
storageClient.setAccessKey("");
storageClient.setSecretKey("");
storageClient.setRegion("");
}

/* redeploy test DELETE LATER
logger.info("Redeploy test S3 access key is updated as {}", appSettings.getS3AccessKey() );*/
logger.info("Redeploy test S3 access key is updated as {}", storageClient.getAccessKey() );*/


appSettings.setGeneratePreview(newSettings.isGeneratePreview());
Expand Down

0 comments on commit 18082db

Please sign in to comment.