forked from bacalhau-project/bacalhau
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
38 lines (29 loc) · 894 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
package main
import (
"fmt"
"os"
"github.com/bacalhau-project/bacalhau/cmd/cli"
"github.com/bacalhau-project/bacalhau/pkg/config"
_ "github.com/bacalhau-project/bacalhau/pkg/version"
"github.com/joho/godotenv"
"github.com/rs/zerolog/log"
"github.com/bacalhau-project/bacalhau/pkg/logger"
"github.com/bacalhau-project/bacalhau/pkg/system"
)
func main() {
defer func() {
// Make sure any buffered logs are written if something failed before logging was configured.
logger.LogBufferedLogs(nil)
}()
_ = godotenv.Load()
devstackEnvFile := config.DevstackEnvFile()
if _, err := os.Stat(devstackEnvFile); err == nil {
log.Debug().Msgf("Loading environment from %s", devstackEnvFile)
_ = godotenv.Overload(devstackEnvFile)
}
if err := system.InitConfig(); err != nil {
fmt.Fprintf(os.Stderr, "Failed to initialize config: %s\n", err)
os.Exit(1)
}
cli.Execute()
}