-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
main.go
43 lines (35 loc) · 999 Bytes
/
main.go
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
38
39
40
41
42
43
package main
import (
"embed"
"fmt"
"os"
"github.com/spf13/viper"
"github.com/tphakala/birdnet-go/cmd"
"github.com/tphakala/birdnet-go/internal/conf"
"github.com/tphakala/birdnet-go/internal/httpcontroller"
)
// buildTime is the time when the binary was built.
var buildDate string
//go:embed assets/*
var assetsFs embed.FS
//go:embed views/*
var viewsFs embed.FS
func main() {
// publish the embedded assets and views directories to controller package
httpcontroller.AssetsFs = assetsFs
httpcontroller.ViewsFs = viewsFs
// Load the configuration
settings, err := conf.Load()
if err != nil {
fmt.Fprintf(os.Stderr, "Error loading configuration: %v\n", err)
os.Exit(1)
} else {
fmt.Printf("BirdNET-Go build date: %s, using config file: %s\n", buildDate, viper.ConfigFileUsed())
}
// Execute the root command
rootCmd := cmd.RootCommand(settings)
if err := rootCmd.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "Command execution error: %v\n", err)
os.Exit(1)
}
}