diff options
| author | 2026-05-02 12:58:40 +0700 | |
|---|---|---|
| committer | 2026-05-02 12:58:40 +0700 | |
| commit | 2d727cc1eeb926f5b5ee578a0ee54269e0390a96 (patch) | |
| tree | 40c43fefdf44bd4495b3f56bb5253c6691c8a0f2 /config | |
| parent | ced61eee79d1c06864cd1d580fa6c549365ba213 (diff) | |
| download | web-2d727cc1eeb926f5b5ee578a0ee54269e0390a96.tar.gz web-2d727cc1eeb926f5b5ee578a0ee54269e0390a96.zip | |
refactor: parametrize static & photo storage url
refactor: parametrize allow origins
Diffstat (limited to 'config')
| -rw-r--r-- | config/config.go | 23 | ||||
| -rw-r--r-- | config/config.local.yaml | 22 | ||||
| -rw-r--r-- | config/config.prod.yaml | 22 | ||||
| -rw-r--r-- | config/config.stage.yaml | 22 |
4 files changed, 89 insertions, 0 deletions
diff --git a/config/config.go b/config/config.go index ebe0367..536a333 100644 --- a/config/config.go +++ b/config/config.go @@ -20,6 +20,9 @@ type Config struct { Mail MailConfig `json:"Mail" yaml:"mail" validate:"required"` CanonicalEndpoint string `json:"CanonicalEndpoint" yaml:"canonicalEndpoint" validate:"required"` Meta MetaConfig `json:"Meta" yaml:"meta"` + PhotoStorage PhotoStorageConfig `json:"PhotoStorage" yaml:"photoStorage"` + StaticStorage PhotoTypeConfig `json:"StaticStorage" yaml:"staticStorage"` + AllowOrigins []string `json:"AllowOrigins" yaml:"allowOrigins"` } type BlogPagesConfig struct { @@ -158,6 +161,26 @@ type MetaConfig struct { GoogleSiteVerification string `json:"GoogleSiteVerification" yaml:"googleSiteVerification"` } +type PhotoStorageConfig struct { + Full PhotoTypeConfig `json:"Full" yaml:"full" validate:"required"` + Webp PhotoTypeConfig `json:"Webp" yaml:"webp"` + Thumbnail1600p PhotoTypeConfig `json:"Thumbnail1600p" yaml:"thumbnail1600p"` + Thumbnail1200p PhotoTypeConfig `json:"Thumbnail1200p" yaml:"thumbnail1200p"` + Thumbnail800p PhotoTypeConfig `json:"Thumbnail800p" yaml:"thumbnail800p"` + Thumbnail560p PhotoTypeConfig `json:"Thumbnail560p" yaml:"thumbnail560p"` + Thumbnail320p PhotoTypeConfig `json:"Thumbnail320p" yaml:"thumbnail320p"` + HomePageGifs HomePageGifsConfig `json:"HomePageGifs" yaml:"homePageGifs"` +} + +type PhotoTypeConfig struct { + BaseUrl string `json:"BaseUrl" yaml:"baseUrl" validate:"url,required"` +} + +type HomePageGifsConfig struct { + BaseUrl string `json:"BaseUrl" yaml:"baseUrl" validate:"url,required"` + Indexes []string `json:"Indexes" yaml:"indexes"` +} + func LoadConfig(path string, config *Config) error { fileBytes, err := os.ReadFile(path) if err != nil { diff --git a/config/config.local.yaml b/config/config.local.yaml index c02dc2d..d312504 100644 --- a/config/config.local.yaml +++ b/config/config.local.yaml @@ -46,3 +46,25 @@ mail: trigger: onNewPost: "* * * * *" canonicalEndpoint: 'http://127.0.0.1:3000' +photoStorage: + full: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/full/%s + webp: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp/%s.webp + thumbnail1600p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-1600p/%s.webp + thumbnail1200p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-1200p/%s.webp + thumbnail800p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-800p/%s.webp + thumbnail560p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-560p/%s.webp + thumbnail320p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-320p/%s.webp + homePageGifs: + baseUrl: https://f003.backblazeb2.com/file/sayana-static/home-page-gifs/otter-%s.gif + indexes: ['1', '2', '3'] +staticStorage: + baseUrl: https://f003.backblazeb2.com/file/sayana-static +allowOrigins: + - https://f003.backblazeb2.com diff --git a/config/config.prod.yaml b/config/config.prod.yaml index b40ba57..2c5a159 100644 --- a/config/config.prod.yaml +++ b/config/config.prod.yaml @@ -47,3 +47,25 @@ mail: canonicalEndpoint: 'https://${FQDN}' meta: googleSiteVerification: '${GOOGLE_SITE_VERIFICATION}' +photoStorage: + full: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/full/%s + webp: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp/%s.webp + thumbnail1600p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-1600p/%s.webp + thumbnail1200p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-1200p/%s.webp + thumbnail800p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-800p/%s.webp + thumbnail560p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-560p/%s.webp + thumbnail320p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-320p/%s.webp + homePageGifs: + baseUrl: https://f003.backblazeb2.com/file/sayana-static/home-page-gifs/otter-%s.gif + indexes: ['1', '2', '3'] +staticStorage: + baseUrl: https://f003.backblazeb2.com/file/sayana-static +allowOrigins: + - https://f003.backblazeb2.com diff --git a/config/config.stage.yaml b/config/config.stage.yaml index efa94ae..0889c19 100644 --- a/config/config.stage.yaml +++ b/config/config.stage.yaml @@ -45,3 +45,25 @@ mail: trigger: onNewPost: "0/3 * * * *" canonicalEndpoint: 'https://${FQDN}' +photoStorage: + full: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/full/%s + webp: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp/%s.webp + thumbnail1600p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-1600p/%s.webp + thumbnail1200p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-1200p/%s.webp + thumbnail800p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-800p/%s.webp + thumbnail560p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-560p/%s.webp + thumbnail320p: + baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-320p/%s.webp + homePageGifs: + baseUrl: https://f003.backblazeb2.com/file/sayana-static/home-page-gifs/otter-%s.gif + indexes: ['1', '2', '3'] +staticStorage: + baseUrl: https://f003.backblazeb2.com/file/sayana-static +allowOrigins: + - https://f003.backblazeb2.com |