Add functionality to upload images to S3
This change adds the following functionality:
- Add the motion detection image to a S3 bucket.
- Pass a presigned URL linking to the image in the JSON payload of the
MQTT event message.
- Add the possibility of customizing whether images are uploaded to a S3
bucket or not.
Change-Id: Id82401839e92dbc62f3bbd1e7e7f0adeeb5718a6
diff --git a/cmd/hichipbridge/serve.go b/cmd/hichipbridge/serve.go
index 17b944e..05c3048 100644
--- a/cmd/hichipbridge/serve.go
+++ b/cmd/hichipbridge/serve.go
@@ -146,6 +146,12 @@
"MQTT_PASSWORD",
"MQTT_TOPIC",
"EMAIL_TOKEN",
+ "S3_ENABLED",
+ "S3_ENDPOINT",
+ "S3_ACCESS_KEY",
+ "S3_SECRET_KEY",
+ "S3_USE_SSL",
+ "S3_BUCKET",
}
// Load in the config.
@@ -185,6 +191,12 @@
"mqtt_password": envs["MQTT_PASSWORD"],
"mqtt_topic": envs["MQTT_TOPIC"],
"mqtt_email_token": envs["EMAIL_TOKEN"],
+ "s3_enabled": envs["S3_ENABLED"],
+ "s3_endpoint": envs["S3_ENDPOINT"],
+ "s3_access_key": envs["S3_ACCESS_KEY"],
+ "s3_secret_key": envs["S3_SECRET_KEY"],
+ "s3_use_ssl": envs["S3_USE_SSL"],
+ "s3_bucket": envs["S3_BUCKET"],
}
for i, _ := range appConfig.Servers {