Skip to content

Commit c780db8

Browse files
committed
If no credentials are found, then throw an error instead of failing at file credentials
1 parent 1ba1872 commit c780db8

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
@@ -361,8 +361,10 @@ void kinesis_video_producer_init(GstKvsSink *kvssink)
361361
session_token_str,
362362
std::chrono::seconds(DEFAULT_ROTATION_PERIOD_SECONDS)));
363363
credential_provider.reset(new StaticCredentialProvider(*kvssink->credentials_));
364-
} else {
364+
} else if (kvssink->credential_file_path != nullptr && static_cast<bool>(std::ifstream(kvssink->credential_file_path))) {
365365
credential_provider.reset(new RotatingCredentialProvider(kvssink->credential_file_path));
366+
} else {
367+
throw runtime_error("Could not find any AWS credentials!");
366368
}
367369

368370
// 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)