Eric Bower
·
11 Nov 24
config.go
1package pgs
2
3import (
4 "github.com/picosh/pico/shared"
5 "github.com/picosh/utils"
6)
7
8var maxSize = uint64(25 * utils.MB)
9var maxAssetSize = int64(10 * utils.MB)
10
11// Needs to be small for caching files like _headers and _redirects.
12var maxSpecialFileSize = int64(5 * utils.KB)
13
14func NewConfigSite() *shared.ConfigSite {
15 domain := utils.GetEnv("PGS_DOMAIN", "pgs.sh")
16 port := utils.GetEnv("PGS_WEB_PORT", "3000")
17 protocol := utils.GetEnv("PGS_PROTOCOL", "https")
18 storageDir := utils.GetEnv("PGS_STORAGE_DIR", ".storage")
19 minioURL := utils.GetEnv("MINIO_URL", "")
20 minioUser := utils.GetEnv("MINIO_ROOT_USER", "")
21 minioPass := utils.GetEnv("MINIO_ROOT_PASSWORD", "")
22 dbURL := utils.GetEnv("DATABASE_URL", "")
23
24 cfg := shared.ConfigSite{
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: "pgs",
34 MaxSize: maxSize,
35 MaxAssetSize: maxAssetSize,
36 MaxSpecialFileSize: maxSpecialFileSize,
37 Logger: shared.CreateLogger("pgs"),
38 }
39
40 return &cfg
41}