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