forked from nyaruka/courier
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
debc5e7
commit d0914ab
Showing
74 changed files
with
5,576 additions
and
13,884 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,66 @@ | ||
package courier | ||
|
||
import "github.com/nyaruka/ezconf" | ||
|
||
// Config is our top level configuration object | ||
type Config struct { | ||
Backend string `help:"the backend that will be used by courier (currently only rapidpro is supported)"` | ||
SentryDSN string `help:"the DSN used for logging errors to Sentry"` | ||
Domain string `help:"the domain courier is exposed on"` | ||
Port int `help:"the port courier will listen on"` | ||
DB string `help:"URL describing how to connect to the RapidPro database"` | ||
Redis string `help:"URL describing how to connect to Redis"` | ||
SpoolDir string `help:"the local directory where courier will write statuses or msgs that need to be retried (needs to be writable)"` | ||
S3Region string `help:"the S3 region we will write attachments to"` | ||
S3MediaBucket string `help:"the S3 bucket we will write attachments to"` | ||
S3MediaPrefix string `help:"the prefix that will be added to attachment filenames"` | ||
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"` | ||
MaxWorkers int `help:"the maximum number of go routines that will be used for sending (set to 0 to disable sending)"` | ||
LibratoUsername string `help:"the username that will be used to authenticate to Librato"` | ||
LibratoToken string `help:"the token that will be used to authenticate to Librato"` | ||
StatusUsername string `help:"the username that is needed to authenticate against the /status endpoint"` | ||
StatusPassword string `help:"the password that is needed to authenticate against the /status endpoint"` | ||
LogLevel string `help:"the logging level courier should use"` | ||
IgnoreDeliveryReports bool `help:"whether we ignore delivered status reports (errors will still be handled)"` | ||
Version string `help:"the version that will be used in request and response headers"` | ||
|
||
// IncludeChannels is the list of channels to enable, empty means include all | ||
IncludeChannels []string | ||
|
||
// ExcludeChannels is the list of channels to exclude, empty means exclude none | ||
ExcludeChannels []string | ||
} | ||
|
||
// NewConfig returns a new default configuration object | ||
func NewConfig() *Config { | ||
return &Config{ | ||
Backend: "rapidpro", | ||
Domain: "localhost", | ||
Port: 8080, | ||
DB: "postgres://courier@localhost/courier?sslmode=disable", | ||
Redis: "redis://localhost:6379/0", | ||
SpoolDir: "/var/spool/courier", | ||
S3Region: "us-east-1", | ||
S3MediaBucket: "courier-media", | ||
S3MediaPrefix: "/media/", | ||
AWSAccessKeyID: "missing_aws_access_key_id", | ||
AWSSecretAccessKey: "missing_aws_secret_access_key", | ||
MaxWorkers: 32, | ||
LogLevel: "error", | ||
Version: "Dev", | ||
} | ||
} | ||
|
||
// LoadConfig loads our configuration from the passed in filename | ||
func LoadConfig(filename string) *Config { | ||
config := NewConfig() | ||
loader := ezconf.NewLoader( | ||
config, | ||
"courier", "Courier - A fast message broker for SMS and IP messages", | ||
[]string{filename}, | ||
) | ||
|
||
loader.MustLoad() | ||
return config | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.