Lay out basic config file structure.
[mailpopbox.git] / mailpopbox.go
1 package main
2
3 import (
4 "encoding/json"
5 "fmt"
6 "os"
7 )
8
9 func main() {
10 if len(os.Args) != 2 {
11 fmt.Fprintf(os.Stderr, "Usage: %s config.json\n", os.Args[0])
12 os.Exit(1)
13 }
14
15 configFile, err := os.Open(os.Args[1])
16 if err != nil {
17 fmt.Fprintf(os.Stderr, "config file: %s\n", err)
18 os.Exit(2)
19 }
20
21 var config Config
22 if err := json.NewDecoder(configFile).Decode(&config); err != nil {
23 fmt.Fprintf(os.Stderr, "config file: %s\n", err)
24 os.Exit(3)
25 }
26 configFile.Close()
27 }