-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathmain.go
More file actions
36 lines (28 loc) · 801 Bytes
/
main.go
File metadata and controls
36 lines (28 loc) · 801 Bytes
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
package main
import (
"errors"
"fmt"
"github.com/italia/publiccode-crawler/v4/cmd"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
)
func main() {
log.SetLevel(log.DebugLevel)
// Read configurations.
viper.SetConfigName("config")
viper.AddConfigPath(".")
// Enable VIPER to read Environment Variables
viper.AutomaticEnv()
viper.SetDefault("DATADIR", "./data")
viper.SetDefault("ACTIVITY_DAYS", 60)
viper.SetDefault("API_BASEURL", "https://api.developers.italia.it/v1/")
viper.SetDefault("MAIN_PUBLISHER_ID", "")
viper.SetDefault("GITHUB_TOKEN", "")
if err := viper.ReadInConfig(); err != nil {
var notFoundError viper.ConfigFileNotFoundError
if !errors.As(err, ¬FoundError) {
panic(fmt.Errorf("error reading config file: %w", err))
}
}
cmd.Execute()
}