1
0
forked from sm/vain

Add an env subcommand

Change-Id: I79fb0897fe87a0598e90bf652570e4a9ae5e6dce
This commit is contained in:
Stephen McQuay 2016-06-15 02:35:40 -07:00
parent 480304bd87
commit 1bceefffb0
No known key found for this signature in database
GPG Key ID: 1ABF428F71BAFC3D

View File

@ -113,15 +113,27 @@ func main() {
fmt.Fprintf(os.Stderr, "problem processing environment: %v", err) fmt.Fprintf(os.Stderr, "problem processing environment: %v", err)
os.Exit(1) os.Exit(1)
} }
log.Printf("%+v", c)
if len(os.Args) > 1 { if len(os.Args) > 1 {
switch os.Args[1] { switch os.Args[1] {
case "env", "e", "help", "h": case "env", "e":
fmt.Printf("VAIN_PORT: %v\n", c.Port)
fmt.Printf("VAIN_INSECURE: %v\n", c.Insecure)
fmt.Printf("VAIN_CERT: %v\n", c.Cert)
fmt.Printf("VAIN_KEY: %v\n", c.Key)
fmt.Printf("VAIN_STATIC: %v\n", c.Static)
fmt.Printf("VAIN_EMAIL_TIMEOUT: %v\n", c.EmailTimeout)
fmt.Printf("VAIN_SMTP_HOST: %v\n", c.SMTPHost)
fmt.Printf("VAIN_SMTP_PORT: %v\n", c.SMTPPort)
fmt.Printf("VAIN_FROM: %v\n", c.From)
os.Exit(0)
case "help", "h":
fmt.Printf("%s\n", usage) fmt.Printf("%s\n", usage)
os.Exit(0) os.Exit(0)
} }
} }
log.Printf("%+v", c)
m, err := vain.NewEmail(c.From, c.SMTPHost, c.SMTPPort) m, err := vain.NewEmail(c.From, c.SMTPHost, c.SMTPPort)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "problem initializing mailer: %v", err) fmt.Fprintf(os.Stderr, "problem initializing mailer: %v", err)