.env.example, addr config, working on banned mime types

This commit is contained in:
2026-11-15 11:22:50 -05:00
parent 93da714ed0
commit e1e0c8042e
5 changed files with 28 additions and 4 deletions
+5 -1
View File
@@ -16,10 +16,12 @@ type Config struct {
MaxFileBytes int64
Expiries []Expiry
NormalizeMIMETypes bool
BannedMIMETypes []string
DatabasePath string
// public host like "https://bin.zip", NOT the address minbin listens on
Host string
Addr string
}
func loadConfig() (Config, error) {
@@ -61,10 +63,12 @@ func loadConfig() (Config, error) {
MaxPasteBytes: maxPasteKiB * 1024,
MaxFileBytes: maxFileKiB * 1024,
Expiries: expiries,
NormalizeMIMETypes: envOrDefault("MINIBIN_NORMALIZE_MIME_TYPE", "true") == "true",
NormalizeMIMETypes: envOrDefault("MINIBIN_NORMALIZE_MIME_TYPES", "true") == "true",
BannedMIMETypes: strings.Split(envOrDefault("MINIBIN_BANNED_MIME_TYPES", ""), ","),
DatabasePath: envOrDefault("MINIBIN_DATABASE_PATH", "minibin.sqlite"),
Host: envOrDefault("MINIBIN_HOST", "http://localhost:8080"),
Addr: envOrDefault("MINIBIN_ADDR", "localhost:8080"),
}, nil
}