blob: ee61a6845df24b3989e77237ebc29f0191ab9fae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
package main
import (
"fmt"
"os"
"website/internal/builder"
"website/internal/log"
"github.com/ardanlabs/conf/v3"
"github.com/pkg/errors"
)
func main() {
ioConfig := builder.IOConfig{}
if help, err := conf.Parse("", &ioConfig); err != nil {
if errors.Is(err, conf.ErrHelpWanted) {
fmt.Println(help)
os.Exit(1)
}
panic("error parsing configuration: " + err.Error())
}
log.Configure(!ioConfig.Development)
log.Debug("starting build process")
if ioConfig.Source != "." {
err := os.Chdir(ioConfig.Source)
if err != nil {
log.Panic("could not change to source directory")
}
}
_, err := builder.BuildSite(ioConfig)
if err != nil {
log.Error("could not build site", "error", err)
os.Exit(1)
}
}
|