summaryrefslogtreecommitdiff
path: root/config/config.go
diff options
from:
to:
context:
space:
mode:
authorGravatar SayaAndy <saya.andy@posteo.com> 2026-05-02 12:58:40 +0700
committerGravatar SayaAndy <saya.andy@posteo.com> 2026-05-02 12:58:40 +0700
commit2d727cc1eeb926f5b5ee578a0ee54269e0390a96 (patch)
tree40c43fefdf44bd4495b3f56bb5253c6691c8a0f2 /config/config.go
parentced61eee79d1c06864cd1d580fa6c549365ba213 (diff)
downloadweb-2d727cc1eeb926f5b5ee578a0ee54269e0390a96.tar.gz
web-2d727cc1eeb926f5b5ee578a0ee54269e0390a96.zip
refactor: parametrize static & photo storage url
refactor: parametrize allow origins
Diffstat (limited to 'config/config.go')
-rw-r--r--config/config.go23
1 files changed, 23 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 {