config

package
v1.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAssetsPath = "./assets"
View Source
const DefaultMigrationsPath = "./migrations"
View Source
const DefaultTemplatesPath = "./templates"

Variables

View Source
var Path = "media-repo.yaml"
View Source
var Runtime = &runtimeConfig{}

Functions

func CheckDeprecations

func CheckDeprecations()

func PrintDomainInfo

func PrintDomainInfo()

func Watch

func Watch() *fsnotify.Watcher

Types

type AccessTokenConfig

type AccessTokenConfig struct {
	MaxCacheTimeSeconds int                `yaml:"maxCacheTimeSeconds"`
	UseAppservices      bool               `yaml:"useLocalAppserviceConfig"`
	Appservices         []AppserviceConfig `yaml:"appservices,flow"`
}

type AppserviceConfig

type AppserviceConfig struct {
	Id              string                          `yaml:"id"`
	AppserviceToken string                          `yaml:"asToken"`
	SenderUserId    string                          `yaml:"senderUserId"`
	UserNamespaces  []AppserviceUserNamespaceConfig `yaml:"userNamespaces,flow"`
}

type AppserviceUserNamespaceConfig

type AppserviceUserNamespaceConfig struct {
	Regex string `yaml:"regex"`
}

type ArchivingConfig

type ArchivingConfig struct {
	Enabled            bool  `yaml:"enabled"`
	SelfService        bool  `yaml:"selfService"`
	TargetBytesPerPart int64 `yaml:"targetBytesPerPart"`
}

type DatabaseConfig

type DatabaseConfig struct {
	Postgres string        `yaml:"postgres"`
	Pool     *DbPoolConfig `yaml:"pool"`
}

type DatastoreConfig

type DatastoreConfig struct {
	Id         string            `yaml:"id"`
	Type       string            `yaml:"type"`
	MediaKinds []string          `yaml:"forKinds,flow"`
	Options    map[string]string `yaml:"opts,flow"`
}

func UniqueDatastores

func UniqueDatastores() []DatastoreConfig

type DbPoolConfig

type DbPoolConfig struct {
	MaxConnections int `yaml:"maxConnections"`
	MaxIdle        int `yaml:"maxIdleConnections"`
}

type DomainRepoConfig

type DomainRepoConfig struct {
	MinimumRepoConfig `yaml:",inline"`
	HomeserverConfig  `yaml:",inline"`
	Downloads         DownloadsConfig   `yaml:"downloads"`
	Thumbnails        ThumbnailsConfig  `yaml:"thumbnails"`
	UrlPreviews       UrlPreviewsConfig `yaml:"urlPreviews"`
}

func AllDomains

func AllDomains() []*DomainRepoConfig

func DomainConfigFrom

func DomainConfigFrom(c MainRepoConfig) DomainRepoConfig

func GetDomain

func GetDomain(domain string) *DomainRepoConfig

func NewDefaultDomainConfig

func NewDefaultDomainConfig() DomainRepoConfig

type DownloadsConfig

type DownloadsConfig struct {
	MaxSizeBytes               int64 `yaml:"maxBytes"`
	FailureCacheMinutes        int   `yaml:"failureCacheMinutes"`
	DefaultRangeChunkSizeBytes int64 `yaml:"defaultRangeChunkSizeBytes"`
}

type FeatureConfig

type FeatureConfig struct {
}

type FederationConfig

type FederationConfig struct {
	BackoffAt    int      `yaml:"backoffAt"`
	IgnoredHosts []string `yaml:"ignoredHosts,flow"`
}

type GeneralConfig

type GeneralConfig struct {
	BindAddress      string `yaml:"bindAddress"`
	Port             int    `yaml:"port"`
	LogDirectory     string `yaml:"logDirectory"`
	LogColors        bool   `yaml:"logColors"`
	JsonLogs         bool   `yaml:"jsonLogs"`
	LogLevel         string `yaml:"logLevel"`
	TrustAnyForward  bool   `yaml:"trustAnyForwardedAddress"`
	UseForwardedHost bool   `yaml:"useForwardedHost"`
}

type HomeserverConfig

type HomeserverConfig struct {
	Name            string `yaml:"name"`
	ClientServerApi string `yaml:"csApi"`
	BackoffAt       int    `yaml:"backoffAt"`
	AdminApiKind    string `yaml:"adminApiKind"`
}

type IdenticonsConfig

type IdenticonsConfig struct {
	Enabled bool `yaml:"enabled"`
}

type MainDownloadsConfig

type MainDownloadsConfig struct {
	DownloadsConfig `yaml:",inline"`
	NumWorkers      int `yaml:"numWorkers"`
	ExpireDays      int `yaml:"expireAfterDays"`
}

type MainRepoConfig

type MainRepoConfig struct {
	MinimumRepoConfig `yaml:",inline"`
	General           GeneralConfig         `yaml:"repo"`
	Homeservers       []HomeserverConfig    `yaml:"homeservers,flow"`
	Admins            []string              `yaml:"admins,flow"`
	Database          DatabaseConfig        `yaml:"database"`
	Downloads         MainDownloadsConfig   `yaml:"downloads"`
	Thumbnails        MainThumbnailsConfig  `yaml:"thumbnails"`
	UrlPreviews       MainUrlPreviewsConfig `yaml:"urlPreviews"`
	RateLimit         RateLimitConfig       `yaml:"rateLimit"`
	Metrics           MetricsConfig         `yaml:"metrics"`
	SharedSecret      SharedSecretConfig    `yaml:"sharedSecretAuth"`
	Federation        FederationConfig      `yaml:"federation"`
	Plugins           []PluginConfig        `yaml:"plugins,flow"`
	Sentry            SentryConfig          `yaml:"sentry"`
	Redis             RedisConfig           `yaml:"redis"`
	Tasks             TasksConfig           `yaml:"tasks"`
	PGO               PGOConfig             `yaml:"pgo"`
}

func Get

func Get() *MainRepoConfig

func NewDefaultMainConfig

func NewDefaultMainConfig() MainRepoConfig

type MainThumbnailsConfig

type MainThumbnailsConfig struct {
	ThumbnailsConfig `yaml:",inline"`
	NumWorkers       int `yaml:"numWorkers"`
	ExpireDays       int `yaml:"expireAfterDays"`
}

type MainUrlPreviewsConfig

type MainUrlPreviewsConfig struct {
	UrlPreviewsConfig `yaml:",inline"`
	NumWorkers        int `yaml:"numWorkers"`
	ExpireDays        int `yaml:"expireAfterDays"`
}

type MetricsConfig

type MetricsConfig struct {
	Enabled     bool   `yaml:"enabled"`
	BindAddress string `yaml:"bindAddress"`
	Port        int    `yaml:"port"`
}

type MinimumRepoConfig

type MinimumRepoConfig struct {
	DataStores     []DatastoreConfig `yaml:"datastores"`
	Archiving      ArchivingConfig   `yaml:"archiving"`
	Uploads        UploadsConfig     `yaml:"uploads"`
	Identicons     IdenticonsConfig  `yaml:"identicons"`
	Quarantine     QuarantineConfig  `yaml:"quarantine"`
	TimeoutSeconds TimeoutsConfig    `yaml:"timeouts"`
	Features       FeatureConfig     `yaml:"featureSupport"`
	AccessTokens   AccessTokenConfig `yaml:"accessTokens"`
}

func NewDefaultMinimumRepoConfig

func NewDefaultMinimumRepoConfig() MinimumRepoConfig

type PGOConfig

type PGOConfig struct {
	Enabled   bool   `yaml:"enabled"`
	SubmitUrl string `yaml:"submitUrl"`
	SubmitKey string `yaml:"submitKey"`
}

type PluginConfig

type PluginConfig struct {
	Executable string                 `yaml:"exec"`
	Config     map[string]interface{} `yaml:"config"`
}

type QuarantineConfig

type QuarantineConfig struct {
	ReplaceThumbnails bool   `yaml:"replaceThumbnails"`
	ReplaceDownloads  bool   `yaml:"replaceDownloads"`
	ThumbnailPath     string `yaml:"thumbnailPath"`
	AllowLocalAdmins  bool   `yaml:"allowLocalAdmins"`
}

type QuotaUserConfig

type QuotaUserConfig struct {
	Glob       string `yaml:"glob"`
	MaxBytes   int64  `yaml:"maxBytes"`
	MaxPending int64  `yaml:"maxPending"`
	MaxFiles   int64  `yaml:"maxFiles"`
}

type QuotasConfig

type QuotasConfig struct {
	Enabled    bool              `yaml:"enabled"`
	UserQuotas []QuotaUserConfig `yaml:"users,flow"`
}

type RateLimitConfig

type RateLimitConfig struct {
	RequestsPerSecond float64 `yaml:"requestsPerSecond"`
	Enabled           bool    `yaml:"enabled"`
	BurstCount        int     `yaml:"burst"`
}

type RedisConfig

type RedisConfig struct {
	Enabled bool               `yaml:"enabled"`
	Shards  []RedisShardConfig `yaml:"shards,flow"`
	DbNum   int                `default:"0" yaml:"databaseNumber"`
}

type RedisShardConfig

type RedisShardConfig struct {
	Name    string `yaml:"name"`
	Address string `yaml:"addr"`
}

type SentryConfig

type SentryConfig struct {
	Enabled     bool   `yaml:"enabled"`
	Dsn         string `yaml:"dsn"`
	Environment string `yaml:"environment"`
	Debug       bool   `yaml:"debug"`
}

type SharedSecretConfig

type SharedSecretConfig struct {
	Enabled bool   `yaml:"enabled"`
	Token   string `yaml:"token"`
}

type TasksConfig

type TasksConfig struct {
	NumWorkers int `yaml:"numWorkers"`
}

type ThumbnailSize

type ThumbnailSize struct {
	Width  int `yaml:"width"`
	Height int `yaml:"height"`
}

type ThumbnailsConfig

type ThumbnailsConfig struct {
	MaxSourceBytes      int64           `yaml:"maxSourceBytes"`
	MaxPixels           int             `yaml:"maxPixels"`
	Types               []string        `yaml:"types,flow"`
	MaxAnimateSizeBytes int64           `yaml:"maxAnimateSizeBytes"`
	Sizes               []ThumbnailSize `yaml:"sizes,flow"`
	DynamicSizing       bool            `yaml:"dynamicSizing"`
	AllowAnimated       bool            `yaml:"allowAnimated"`
	DefaultAnimated     bool            `yaml:"defaultAnimated"`
	StillFrame          float32         `yaml:"stillFrame"`
}

type TimeoutsConfig

type TimeoutsConfig struct {
	UrlPreviews  int `yaml:"urlPreviewTimeoutSeconds"`
	Federation   int `yaml:"federationTimeoutSeconds"`
	ClientServer int `yaml:"clientServerTimeoutSeconds"`
}

type UploadsConfig

type UploadsConfig struct {
	MaxSizeBytes         int64        `yaml:"maxBytes"`
	MinSizeBytes         int64        `yaml:"minBytes"`
	ReportedMaxSizeBytes int64        `yaml:"reportedMaxBytes"`
	MaxPending           int64        `yaml:"maxPending"`
	MaxAgeSeconds        int64        `yaml:"maxAgeSeconds"`
	Quota                QuotasConfig `yaml:"quotas"`
}

type UrlPreviewsConfig

type UrlPreviewsConfig struct {
	Enabled            bool     `yaml:"enabled"`
	NumWords           int      `yaml:"numWords"`
	NumTitleWords      int      `yaml:"numTitleWords"`
	MaxLength          int      `yaml:"maxLength"`
	MaxTitleLength     int      `yaml:"maxTitleLength"`
	MaxPageSizeBytes   int64    `yaml:"maxPageSizeBytes"`
	FilePreviewTypes   []string `yaml:"filePreviewTypes,flow"`
	DisallowedNetworks []string `yaml:"disallowedNetworks,flow"`
	AllowedNetworks    []string `yaml:"allowedNetworks,flow"`
	UnsafeCertificates bool     `yaml:"previewUnsafeCertificates"`
	DefaultLanguage    string   `yaml:"defaultLanguage"`
	UserAgent          string   `yaml:"userAgent"`
	OEmbed             bool     `yaml:"oEmbed"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL