Skip to content

Commit

Permalink
cmd/hydroxide: allow overriding app version via CLI arg
Browse files Browse the repository at this point in the history
  • Loading branch information
emersion committed Jun 12, 2023
1 parent 7f8df60 commit d1ca680
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/hydroxide/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,21 @@ import (
smtpbackend "github.com/emersion/hydroxide/smtp"
)

const defaultAPIEndpoint = "https://mail.proton.me/api"
const (
defaultAPIEndpoint = "https://mail.proton.me/api"
defaultAppVersion = "Other"
)

var (
debug bool
apiEndpoint string
appVersion string
)

func newClient() *protonmail.Client {
return &protonmail.Client{
RootURL: apiEndpoint,
AppVersion: "Other",
AppVersion: appVersion,
Debug: debug,
}
}
Expand Down Expand Up @@ -186,6 +190,8 @@ Global options:
Enable debug logs
-api-endpoint <url>
ProtonMail API endpoint
-app-version <version>
ProtonMail application version
-smtp-host example.com
Allowed SMTP email hostname on which hydroxide listens, defaults to 127.0.0.1
-imap-host example.com
Expand Down Expand Up @@ -218,6 +224,7 @@ Environment variables:
func main() {
flag.BoolVar(&debug, "debug", false, "Enable debug logs")
flag.StringVar(&apiEndpoint, "api-endpoint", defaultAPIEndpoint, "ProtonMail API endpoint")
flag.StringVar(&appVersion, "app-version", defaultAppVersion, "ProtonMail app version")

smtpHost := flag.String("smtp-host", "127.0.0.1", "Allowed SMTP email hostname on which hydroxide listens, defaults to 127.0.0.1")
smtpPort := flag.String("smtp-port", "1025", "SMTP port on which hydroxide listens, defaults to 1025")
Expand Down

0 comments on commit d1ca680

Please sign in to comment.