mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 17:47:03 +00:00
Package reorg part 3
- binary "inbucketd" is now "inbucket" - renamed "conf" to "etc" so it doesn't get confused with "config" pacakge dir
This commit is contained in:
47
inbucket.go
Normal file
47
inbucket.go
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
This is the inbucket daemon launcher
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/jhillyerd/inbucket/config"
|
||||
"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 := config.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 inbucket [options] <conf file>:")
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user