Skip to content

Commit fcf018f

Browse files
committed
Rename media config vars
1 parent 1f95711 commit fcf018f

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

core/models/orgs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func (o *Org) AirtimeService(httpClient *http.Client, httpRetries *httpx.RetryCo
171171

172172
// StoreAttachment saves an attachment to storage
173173
func (o *Org) StoreAttachment(ctx context.Context, rt *runtime.Runtime, filename string, contentType string, content io.ReadCloser) (utils.Attachment, error) {
174-
prefix := rt.Config.S3MediaPrefix
174+
prefix := rt.Config.S3AttachmentsPrefix
175175

176176
// read the content
177177
contentBytes, err := io.ReadAll(content)

mailroom.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (mr *Mailroom) Start() error {
129129
if err != nil {
130130
return err
131131
}
132-
mr.rt.AttachmentStorage = storage.NewS3(s3Client, mr.rt.Config.S3MediaBucket, c.S3Region, s3.BucketCannedACLPublicRead, 32)
132+
mr.rt.AttachmentStorage = storage.NewS3(s3Client, mr.rt.Config.S3AttachmentsBucket, c.S3Region, s3.BucketCannedACLPublicRead, 32)
133133
mr.rt.SessionStorage = storage.NewS3(s3Client, mr.rt.Config.S3SessionBucket, c.S3Region, s3.ObjectCannedACLPrivate, 32)
134134
} else {
135135
mr.rt.AttachmentStorage = storage.NewFS("_storage", 0766)

runtime/config.go

+16-16
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ type Config struct {
4949
MaxValueLength int `help:"the maximum size in characters for contact field values and run result values"`
5050
SessionStorage string `validate:"omitempty,session_storage" help:"where to store session output (s3|db)"`
5151

52-
S3Endpoint string `help:"the S3 endpoint we will write attachments to"`
53-
S3Region string `help:"the S3 region we will write attachments to"`
54-
S3MediaBucket string `help:"the S3 bucket we will write attachments to"`
55-
S3MediaPrefix string `help:"the prefix that will be added to attachment filenames"`
56-
S3SessionBucket string `help:"the S3 bucket we will write attachments to"`
57-
S3SessionPrefix string `help:"the prefix that will be added to attachment filenames"`
58-
S3DisableSSL bool `help:"whether we disable SSL when accessing S3. Should always be set to False unless you're hosting an S3 compatible service within a secure internal network"`
59-
S3ForcePathStyle bool `help:"whether we force S3 path style. Should generally need to default to False unless you're hosting an S3 compatible service"`
52+
S3Endpoint string `help:"the S3 endpoint we will write attachments to"`
53+
S3Region string `help:"the S3 region we will write attachments to"`
54+
S3AttachmentsBucket string `help:"the S3 bucket we will write attachments to"`
55+
S3AttachmentsPrefix string `help:"the prefix that will be added to attachment filenames"`
56+
S3SessionBucket string `help:"the S3 bucket we will write attachments to"`
57+
S3SessionPrefix string `help:"the prefix that will be added to attachment filenames"`
58+
S3DisableSSL bool `help:"whether we disable SSL when accessing S3. Should always be set to False unless you're hosting an S3 compatible service within a secure internal network"`
59+
S3ForcePathStyle bool `help:"whether we force S3 path style. Should generally need to default to False unless you're hosting an S3 compatible service"`
6060

6161
AWSAccessKeyID string `help:"the access key id to use when authenticating S3"`
6262
AWSSecretAccessKey string `help:"the secret access key id to use when authenticating S3"`
@@ -106,14 +106,14 @@ func NewDefaultConfig() *Config {
106106
MaxValueLength: 640,
107107
SessionStorage: "db",
108108

109-
S3Endpoint: "https://s3.amazonaws.com",
110-
S3Region: "us-east-1",
111-
S3MediaBucket: "mailroom-media",
112-
S3MediaPrefix: "/attachments/",
113-
S3SessionBucket: "mailroom-sessions",
114-
S3SessionPrefix: "/",
115-
S3DisableSSL: false,
116-
S3ForcePathStyle: false,
109+
S3Endpoint: "https://s3.amazonaws.com",
110+
S3Region: "us-east-1",
111+
S3AttachmentsBucket: "mailroom-attachments",
112+
S3AttachmentsPrefix: "/attachments/",
113+
S3SessionBucket: "mailroom-sessions",
114+
S3SessionPrefix: "/",
115+
S3DisableSSL: false,
116+
S3ForcePathStyle: false,
117117

118118
AWSAccessKeyID: "",
119119
AWSSecretAccessKey: "",

services/tickets/zendesk/service.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func (s *service) push(msg *ExternalResource, logHTTP flows.HTTPLogCallback) err
252252
// is sent to Zendesk as file/1/01c1/1aa4/01c11aa4-770a-4783.jpg
253253
// which it will request as POST https://textit.com/tickets/types/zendesk/file/1/01c1/1aa4/01c11aa4-770a-4783.jpg
254254
func (s *service) convertAttachments(attachments []utils.Attachment) ([]string, error) {
255-
prefix := s.rtConfig.S3MediaPrefix
255+
prefix := s.rtConfig.S3AttachmentsPrefix
256256
if !strings.HasPrefix(prefix, "/") {
257257
prefix = "/" + prefix
258258
}

0 commit comments

Comments
 (0)