1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-21 19:47:03 +00:00

Moved inbucketd to main to make building easier

Updated README.md with a install procedure that actually works
This commit is contained in:
James Hillyerd
2012-10-21 14:47:41 -07:00
parent 3650b93de7
commit 01955d3cb2
2 changed files with 13 additions and 4 deletions

47
main/inbucketd.go Normal file
View File

@@ -0,0 +1,47 @@
/*
This is the inbucket daemon launcher
*/
package main
import (
"flag"
"fmt"
"github.com/jhillyerd/inbucket"
"github.com/jhillyerd/inbucket/smtpd"
"github.com/jhillyerd/inbucket/web"
"os"
)
var help = flag.Bool("help", false, "Displays this help")
func main() {
flag.Parse()
if *help {
flag.Usage()
return
}
// Load & Parse config
if flag.NArg() != 1 {
flag.Usage()
os.Exit(1)
}
err := inbucket.LoadConfig(flag.Arg(0))
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to parse config: %v\n", err)
os.Exit(1)
}
// Startup SMTP server
server := smtpd.New()
go server.Start()
web.Start()
}
func init() {
flag.Usage = func() {
fmt.Fprintln(os.Stderr, "Usage of inbucketd [options] <conf file>:")
flag.PrintDefaults()
}
}