Antonio Mika
·
08 Oct 24
config.go
1package pastes
2
3import (
4 "github.com/picosh/pico/shared"
5 "github.com/picosh/utils"
6)
7
8func NewConfigSite() *shared.ConfigSite {
9 debug := utils.GetEnv("PASTES_DEBUG", "0")
10 domain := utils.GetEnv("PASTES_DOMAIN", "pastes.sh")
11 port := utils.GetEnv("PASTES_WEB_PORT", "3000")
12 dbURL := utils.GetEnv("DATABASE_URL", "")
13 protocol := utils.GetEnv("PASTES_PROTOCOL", "https")
14 storageDir := utils.GetEnv("IMGS_STORAGE_DIR", ".storage")
15 minioURL := utils.GetEnv("MINIO_URL", "")
16 minioUser := utils.GetEnv("MINIO_ROOT_USER", "")
17 minioPass := utils.GetEnv("MINIO_ROOT_PASSWORD", "")
18
19 return &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: "pastes",
30 Logger: shared.CreateLogger("pastes"),
31 }
32}