Antonio Mika
·
08 Oct 24
config.go
1package feeds
2
3import (
4 "github.com/picosh/pico/shared"
5 "github.com/picosh/utils"
6)
7
8func NewConfigSite() *shared.ConfigSite {
9 debug := utils.GetEnv("FEEDS_DEBUG", "0")
10 domain := utils.GetEnv("FEEDS_DOMAIN", "feeds.pico.sh")
11 port := utils.GetEnv("FEEDS_WEB_PORT", "3000")
12 protocol := utils.GetEnv("FEEDS_PROTOCOL", "https")
13 storageDir := utils.GetEnv("IMGS_STORAGE_DIR", ".storage")
14 minioURL := utils.GetEnv("MINIO_URL", "")
15 minioUser := utils.GetEnv("MINIO_ROOT_USER", "")
16 minioPass := utils.GetEnv("MINIO_ROOT_PASSWORD", "")
17 dbURL := utils.GetEnv("DATABASE_URL", "")
18 sendgridKey := utils.GetEnv("SENDGRID_API_KEY", "")
19
20 return &shared.ConfigSite{
21 Debug: debug == "1",
22 SendgridKey: sendgridKey,
23 Domain: domain,
24 Port: port,
25 Protocol: protocol,
26 DbURL: dbURL,
27 StorageDir: storageDir,
28 MinioURL: minioURL,
29 MinioUser: minioUser,
30 MinioPass: minioPass,
31 Space: "feeds",
32 AllowedExt: []string{".txt"},
33 HiddenPosts: []string{"_header.txt", "_readme.txt"},
34 Logger: shared.CreateLogger("feeds"),
35 }
36}