repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

pico / pkg / apps / prose
Eric Bower  ·  2025-07-04

config.go

 1package prose
 2
 3import (
 4	"strings"
 5
 6	"github.com/picosh/pico/pkg/shared"
 7	"github.com/picosh/utils"
 8)
 9
10var MAX_FILE_SIZE = 3 * utils.MB
11
12func NewConfigSite(service string) *shared.ConfigSite {
13	debug := utils.GetEnv("PROSE_DEBUG", "0")
14	domain := utils.GetEnv("PROSE_DOMAIN", "prose.sh")
15	port := utils.GetEnv("PROSE_WEB_PORT", "3000")
16	protocol := utils.GetEnv("PROSE_PROTOCOL", "https")
17	dbURL := utils.GetEnv("DATABASE_URL", "")
18	maxSize := uint64(25 * utils.MB)
19	maxImgSize := int64(10 * utils.MB)
20	withPipe := strings.ToLower(utils.GetEnv("PICO_PIPE_ENABLED", "true")) == "true"
21
22	return &shared.ConfigSite{
23		Debug:    debug == "1",
24		Domain:   domain,
25		Port:     port,
26		Protocol: protocol,
27		DbURL:    dbURL,
28		Space:    "prose",
29		AllowedExt: []string{
30			".md",
31			".jpg",
32			".jpeg",
33			".png",
34			".gif",
35			".webp",
36			".svg",
37			".ico",
38		},
39		HiddenPosts:  []string{"_readme.md", "_styles.css", "_footer.md", "_404.md"},
40		Logger:       shared.CreateLogger(service, withPipe),
41		MaxSize:      maxSize,
42		MaxAssetSize: maxImgSize,
43	}
44}