Antonio Mika
·
2025-03-12
config.go
1package prose
2
3import (
4 "github.com/picosh/pico/pkg/shared"
5 "github.com/picosh/utils"
6)
7
8var MAX_FILE_SIZE = 3 * utils.MB
9
10func NewConfigSite(service string) *shared.ConfigSite {
11 debug := utils.GetEnv("PROSE_DEBUG", "0")
12 domain := utils.GetEnv("PROSE_DOMAIN", "prose.sh")
13 port := utils.GetEnv("PROSE_WEB_PORT", "3000")
14 protocol := utils.GetEnv("PROSE_PROTOCOL", "https")
15 storageDir := utils.GetEnv("PROSE_STORAGE_DIR", ".storage")
16 minioURL := utils.GetEnv("MINIO_URL", "")
17 minioUser := utils.GetEnv("MINIO_ROOT_USER", "")
18 minioPass := utils.GetEnv("MINIO_ROOT_PASSWORD", "")
19 dbURL := utils.GetEnv("DATABASE_URL", "")
20 maxSize := uint64(25 * utils.MB)
21 maxImgSize := int64(10 * utils.MB)
22
23 return &shared.ConfigSite{
24 Debug: debug == "1",
25 Domain: domain,
26 Port: port,
27 Protocol: protocol,
28 DbURL: dbURL,
29 StorageDir: storageDir,
30 MinioURL: minioURL,
31 MinioUser: minioUser,
32 MinioPass: minioPass,
33 Space: "prose",
34 AllowedExt: []string{
35 ".md",
36 ".jpg",
37 ".jpeg",
38 ".png",
39 ".gif",
40 ".webp",
41 ".svg",
42 ".ico",
43 },
44 HiddenPosts: []string{"_readme.md", "_styles.css", "_footer.md", "_404.md"},
45 Logger: shared.CreateLogger(service),
46 MaxSize: maxSize,
47 MaxAssetSize: maxImgSize,
48 }
49}