]>
src.bluestatic.org Git - mailpopbox.git/blob - mailpopbox.go
2 // Copyright 2020 Blue Static <https://www.bluestatic.org>
3 // This program is free software licensed under the GNU General Public License,
4 // version 3.0. The full text of the license can be found in LICENSE.txt.
5 // SPDX-License-Identifier: GPL-3.0-only
18 if len(os
.Args
) != 2 {
19 fmt
.Fprintf(os
.Stderr
, "Usage: %s config.json\n", os
.Args
[0])
23 if os
.Args
[1] == "version" {
24 fmt
.Print(versionString
)
28 configFile
, err
:= os
.Open(os
.Args
[1])
30 fmt
.Fprintf(os
.Stderr
, "config file: %s\n", err
)
35 if err
:= json
.NewDecoder(configFile
).Decode(&config
); err
!= nil {
36 fmt
.Fprintf(os
.Stderr
, "config file: %s\n", err
)
41 logConfig
:= zap
.NewDevelopmentConfig()
42 logConfig
.Development
= false
43 logConfig
.DisableStacktrace
= true
44 logConfig
.Level
.SetLevel(zap
.DebugLevel
)
45 log
, err
:= logConfig
.Build()
47 fmt
.Fprintf(os
.Stderr
, "create logger: %v\n", err
)
51 log
.Info("starting mailpopbox", zap
.String("hostname", config
.Hostname
))
53 pop3
:= runPOP3Server(config
, log
)
54 smtp
:= runSMTPServer(config
, log
)
59 if cm
== ServerControlRestart
{
60 pop3
= runPOP3Server(config
, log
)
65 // smtp never reloads.