forked from nyaruka/rp-archiver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
54 lines (43 loc) · 2.21 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package archiver
// Config is our top level configuration object
type Config struct {
DB string `help:"the connection string for our database"`
LogLevel string `help:"the log level, one of error, warn, info, debug"`
SentryDSN string `help:"the sentry configuration to log errors to, if any"`
S3Endpoint string `help:"the S3 endpoint we will write archives to"`
S3Region string `help:"the S3 region we will write archives to"`
S3Bucket string `help:"the S3 bucket we will write archives to"`
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"`
S3ForcePathStyle bool `help:"whether we force S3 path style. Should generally need to default to False unless you're hosting an S3 compatible service"`
AWSAccessKeyID string `help:"the access key id to use when authenticating S3"`
AWSSecretAccessKey string `help:"the secret access key id to use when authenticating S3"`
TempDir string `help:"directory where temporary archive files are written"`
KeepFiles bool `help:"whether we should keep local archive files after upload (default false)"`
UploadToS3 bool `help:"whether we should upload archive to S3"`
ArchiveMessages bool `help:"whether we should archive messages"`
ArchiveRuns bool `help:"whether we should archive runs"`
RetentionPeriod int `help:"the number of days to keep before archiving"`
Delete bool `help:"whether to delete messages and runs from the db after archival (default false)"`
}
// NewConfig returns a new default configuration object
func NewConfig() *Config {
config := Config{
DB: "postgres://localhost/archiver_test?sslmode=disable",
LogLevel: "info",
S3Endpoint: "https://s3.amazonaws.com",
S3Region: "us-east-1",
S3Bucket: "dl-archiver-test",
S3DisableSSL: false,
S3ForcePathStyle: false,
AWSAccessKeyID: "missing_aws_access_key_id",
AWSSecretAccessKey: "missing_aws_secret_access_key",
TempDir: "/tmp",
KeepFiles: false,
UploadToS3: true,
ArchiveMessages: true,
ArchiveRuns: true,
RetentionPeriod: 90,
Delete: false,
}
return &config
}