Eric Bower
·
11 Nov 24
config.go
1package prose
2
3import (
4 "github.com/picosh/pico/shared"
5 "github.com/picosh/utils"
6)
7
8func NewConfigSite() *shared.ConfigSite {
9 debug := utils.GetEnv("PROSE_DEBUG", "0")
10 domain := utils.GetEnv("PROSE_DOMAIN", "prose.sh")
11 port := utils.GetEnv("PROSE_WEB_PORT", "3000")
12 protocol := utils.GetEnv("PROSE_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 maxSize := uint64(500 * utils.MB)
19 maxImgSize := int64(10 * utils.MB)
20
21 return &shared.ConfigSite{
22 Debug: debug == "1",
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: "prose",
32 AllowedExt: []string{
33 ".md",
34 ".jpg",
35 ".jpeg",
36 ".png",
37 ".gif",
38 ".webp",
39 ".svg",
40 ".ico",
41 },
42 HiddenPosts: []string{"_readme.md", "_styles.css", "_footer.md", "_404.md"},
43 Logger: shared.CreateLogger("prose"),
44 MaxSize: maxSize,
45 MaxAssetSize: maxImgSize,
46 }
47}