feat: image variants engine
This commit is contained in:
1 parent
f0845de643
commit
f1d56ef50e
80 files changed
+7312
-84
No files matched your search
@@ -22,22 +22,25 @@ type AuthRateLimitSettings struct {
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
Environment string
|
||||
CorsAllowedOrigins []string
|
||||
PublicURL string
|
||||
UploadDir string
|
||||
JWTSecret string
|
||||
DBFile string
|
||||
Database DatabaseSettings
|
||||
Storage StorageSettings
|
||||
DataDirPath string
|
||||
Port string
|
||||
Smtp SmtpSettings
|
||||
AuthRateLimit AuthRateLimitSettings
|
||||
TrustedProxies []string
|
||||
Version string
|
||||
UpdateFeedURL string
|
||||
Container bool
|
||||
Environment string
|
||||
CorsAllowedOrigins []string
|
||||
PublicURL string
|
||||
UploadDir string
|
||||
JWTSecret string
|
||||
DBFile string
|
||||
Database DatabaseSettings
|
||||
Storage StorageSettings
|
||||
DataDirPath string
|
||||
Port string
|
||||
Smtp SmtpSettings
|
||||
AuthRateLimit AuthRateLimitSettings
|
||||
TrustedProxies []string
|
||||
Version string
|
||||
UpdateFeedURL string
|
||||
Container bool
|
||||
ImageVariantMaxSourceBytes int64
|
||||
ImageVariantMaxSourcePixels int64
|
||||
ImageVariantMaxConcurrentRenders int
|
||||
}
|
||||
|
||||
func (s Settings) DataDir() string {
|
||||
@@ -77,6 +80,21 @@ func NewSettingsFromEnv() (Settings, error) {
|
||||
return Settings{}, err
|
||||
}
|
||||
|
||||
maxSourceBytes, err := imageVariantMaxSourceBytesFromEnv()
|
||||
if err != nil {
|
||||
return Settings{}, err
|
||||
}
|
||||
|
||||
maxSourcePixels, err := imageVariantMaxSourcePixelsFromEnv()
|
||||
if err != nil {
|
||||
return Settings{}, err
|
||||
}
|
||||
|
||||
maxConcurrentRenders, err := imageVariantMaxConcurrentRendersFromEnv()
|
||||
if err != nil {
|
||||
return Settings{}, err
|
||||
}
|
||||
|
||||
return Settings{
|
||||
Environment: os.Getenv("ENVIRONMENT"),
|
||||
CorsAllowedOrigins: parseSemicolonSeparatedList(os.Getenv("CORS_ALLOWED_ORIGINS")),
|
||||
@@ -99,9 +117,12 @@ func NewSettingsFromEnv() (Settings, error) {
|
||||
MaxAttempts: authRateLimitMaxAttempts,
|
||||
Window: time.Duration(authRateLimitWindowSeconds) * time.Second,
|
||||
},
|
||||
TrustedProxies: parseSemicolonSeparatedList(os.Getenv("TRUSTED_PROXIES")),
|
||||
UpdateFeedURL: os.Getenv("UPDATE_FEED_URL"),
|
||||
Container: strings.EqualFold(os.Getenv("RENEWCMS_CONTAINER"), "true"),
|
||||
TrustedProxies: parseSemicolonSeparatedList(os.Getenv("TRUSTED_PROXIES")),
|
||||
UpdateFeedURL: os.Getenv("UPDATE_FEED_URL"),
|
||||
Container: strings.EqualFold(os.Getenv("RENEWCMS_CONTAINER"), "true"),
|
||||
ImageVariantMaxSourceBytes: maxSourceBytes,
|
||||
ImageVariantMaxSourcePixels: maxSourcePixels,
|
||||
ImageVariantMaxConcurrentRenders: maxConcurrentRenders,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user