repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

pico / imgs
Antonio Mika · 08 Oct 24

config.go

 1package imgs
 2
 3import (
 4	"github.com/picosh/pico/shared"
 5	"github.com/picosh/utils"
 6)
 7
 8func NewConfigSite() *shared.ConfigSite {
 9	debug := utils.GetEnv("IMGS_DEBUG", "0")
10	domain := utils.GetEnv("IMGS_DOMAIN", "prose.sh")
11	port := utils.GetEnv("IMGS_WEB_PORT", "3000")
12	protocol := utils.GetEnv("IMGS_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
19	cfg := shared.ConfigSite{
20		Debug:      debug == "1",
21		Domain:     domain,
22		Port:       port,
23		Protocol:   protocol,
24		DbURL:      dbURL,
25		StorageDir: storageDir,
26		MinioURL:   minioURL,
27		MinioUser:  minioUser,
28		MinioPass:  minioPass,
29		Space:      "imgs",
30		AllowedExt: []string{".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".ico"},
31		Logger:     shared.CreateLogger("imgs"),
32	}
33
34	return &cfg
35}