forked from knadh/listmonk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request knadh#31 from mr-karan/s3
feat: Add media package that allows pluggable backends (filesystem / s3) for media file uploads.
- Loading branch information
Showing
13 changed files
with
462 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/azds.yaml | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ frontend/yarn.lock | |
config.toml | ||
node_modules | ||
listmonk | ||
dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,14 +24,6 @@ from_email = "listmonk <[email protected]>" | |
# To disable notifications, set an empty list, eg: notify_emails = [] | ||
notify_emails = ["[email protected]", "[email protected]"] | ||
|
||
# Path to the uploads directory where media will be uploaded. | ||
upload_path = "uploads" | ||
|
||
# Upload URI that's visible to the outside world. The media | ||
# uploaded to upload_path will be made available publicly | ||
# under this URI, for instance, list.yoursite.com/uploads. | ||
upload_uri = "/uploads" | ||
|
||
# Maximum concurrent workers that will attempt to send messages | ||
# simultaneously. This should depend on the number of CPUs the | ||
# machine has and also the number of simultaenous e-mails the | ||
|
@@ -110,3 +102,33 @@ ssl_mode = "disable" | |
|
||
# Maximum concurrent connections to the SMTP server. | ||
max_conns = 10 | ||
|
||
# Upload settings | ||
[upload] | ||
# Provider which will be used to host uploaded media. Bundled providers are "filesystem" and "s3". | ||
provider = "filesystem" | ||
|
||
# S3 Provider settings | ||
[upload.s3] | ||
# (Optional). AWS Access Key and Secret Key for the user to access the bucket. Leaving it empty would default to use | ||
# instance IAM role. | ||
aws_access_key_id = "" | ||
aws_secret_access_key = "" | ||
# AWS Region where S3 bucket is hosted. | ||
aws_default_region="ap-south-1" | ||
# Specify bucket name. | ||
bucket="" | ||
# Path where the files will be stored inside bucket. Empty value ("") means the root of bucket. | ||
bucket_path="" | ||
# Bucket type can be "private" or "public". | ||
bucket_type="public" | ||
# (Optional) Specify TTL (in seconds) for the generated presigned URL. Expiry value is used only if the bucket is private. | ||
expiry="86400" | ||
|
||
# Filesystem provider settings | ||
[upload.filesystem] | ||
# Path to the uploads directory where media will be uploaded. Leaving it empty ("") means current working directory. | ||
upload_path="" | ||
# Upload URI that's visible to the outside world. The media uploaded to upload_path will be made available publicly | ||
# under this URI, for instance, list.yoursite.com/uploads. | ||
upload_uri = "/uploads" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package media | ||
|
||
import ( | ||
"io" | ||
|
||
"gopkg.in/volatiletech/null.v6" | ||
) | ||
|
||
// Media represents an uploaded object. | ||
type Media struct { | ||
ID int `db:"id" json:"id"` | ||
UUID string `db:"uuid" json:"uuid"` | ||
Filename string `db:"filename" json:"filename"` | ||
Width int `db:"width" json:"width"` | ||
Height int `db:"height" json:"height"` | ||
CreatedAt null.Time `db:"created_at" json:"created_at"` | ||
ThumbURI string `json:"thumb_uri"` | ||
URI string `json:"uri"` | ||
} | ||
|
||
// Store represents set of methods to perform upload/delete operations. | ||
type Store interface { | ||
Put(string, string, io.ReadSeeker) (string, error) | ||
Delete(string) error | ||
Get(string) string | ||
} |
Oops, something went wrong.