Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Commit 9dfa29c

Browse files
committed
Add s3SinkEndpoint option
Signed-off-by: Sho Okada <shokada3@gmail.com>
1 parent eec9229 commit 9dfa29c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

sinks/interfaces.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ func ManufactureSink() (e EventSinkInterface) {
104104
panic("s3 sink specified but s3SinkBucketDir not specified")
105105
}
106106

107+
endpoint := viper.GetString("s3SinkEndpoint")
108+
107109
// By default the json is pushed to s3 in not flatenned rfc5424 write format
108110
// The option to write to s3 is in the flattened json format which will help in
109111
// using the data in redshift with least effort
@@ -124,7 +126,7 @@ func ManufactureSink() (e EventSinkInterface) {
124126
bufferSize := viper.GetInt("s3SinkBufferSize")
125127
overflow := viper.GetBool("s3SinkDiscardMessages")
126128

127-
s, err := NewS3Sink(accessKeyID, secretAccessKey, region, bucket, bucketDir, uploadInterval, overflow, bufferSize, outputFormat)
129+
s, err := NewS3Sink(accessKeyID, secretAccessKey, region, bucket, bucketDir, uploadInterval, overflow, bufferSize, outputFormat, endpoint)
128130
if err != nil {
129131
panic(err.Error())
130132
}

sinks/s3sink.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,16 @@ type S3Sink struct {
5454
}
5555

5656
// NewS3Sink is the factory method constructing a new S3Sink
57-
func NewS3Sink(awsAccessKeyID string, s3SinkSecretAccessKey string, s3SinkRegion string, s3SinkBucket string, s3SinkBucketDir string, s3SinkUploadInterval int, overflow bool, bufferSize int, outputFormat string) (*S3Sink, error) {
57+
func NewS3Sink(awsAccessKeyID string, s3SinkSecretAccessKey string, s3SinkRegion string, s3SinkBucket string, s3SinkBucketDir string, s3SinkUploadInterval int, overflow bool, bufferSize int, outputFormat string, s3SinkEndpoint string) (*S3Sink, error) {
5858
awsConfig := &aws.Config{
5959
Region: aws.String(s3SinkRegion),
6060
Credentials: credentials.NewStaticCredentials(awsAccessKeyID, s3SinkSecretAccessKey, ""),
6161
}
6262

63+
if s3SinkEndpoint != "" {
64+
awsConfig = awsConfig.WithEndpoint(s3SinkEndpoint)
65+
}
66+
6367
awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true)
6468
sess, err := session.NewSession(awsConfig)
6569
if err != nil {

0 commit comments

Comments
 (0)