Skip to content

Commit d91e54a

Browse files
authored
If no credentials are found, then throw an error instead of failing at file credentials (#1228)
1 parent 585f137 commit d91e54a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/gstreamer/gstkvssink.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,10 @@ void kinesis_video_producer_init(GstKvsSink *kvssink)
366366
session_token_str,
367367
std::chrono::seconds(DEFAULT_ROTATION_PERIOD_SECONDS)));
368368
credential_provider.reset(new StaticCredentialProvider(*kvssink->credentials_));
369-
} else {
369+
} else if (kvssink->credential_file_path != nullptr && static_cast<bool>(std::ifstream(kvssink->credential_file_path))) {
370370
credential_provider.reset(new RotatingCredentialProvider(kvssink->credential_file_path));
371+
} else {
372+
throw runtime_error("Could not find any AWS credentials!");
371373
}
372374

373375
// Handle env for providing CP URL

src/gstreamer/gstkvssink.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <string.h>
3737
#include <mutex>
3838
#include <atomic>
39+
#include <fstream>
3940
#include <gst/base/gstcollectpads.h>
4041
#include <unordered_set>
4142

0 commit comments

Comments
 (0)