config

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var C = &config{
	RequireInvite:              true,
	RequireActivation:          false,
	ActivationExpiry:           2 * 60 * 60,
	EmailCooldown:              5 * 60,
	EmailPort:                  25,
	ImageBackend:               string(FileBackend),
	PHashDistance:              0,
	VoteApplicationThreshold:   3,
	VotePromotionThreshold:     10,
	VoteCronInterval:           "5m",
	VotingPeriod:               345600,
	MinDestructiveVotingPeriod: 172800,
	DraftTimeLimit:             86400,
	EditUpdateLimit:            1,
	RequireSceneDraft:          false,
	RequireTagRole:             false,
}
View Source
var Database = "database"
View Source
var JWTSignKey = "jwt_secret_key"
View Source
var SessionStoreKey = "session_store_key"

Functions

func GetActivationExpiry

func GetActivationExpiry() time.Duration

GetActivationExpiry returns the duration before an activation email expires.

func GetCSP

func GetCSP() string

func GetConfigDirectory

func GetConfigDirectory() string

func GetConfigName

func GetConfigName() string

func GetConnMaxLifetime

func GetConnMaxLifetime() int

func GetDatabasePath

func GetDatabasePath() string

func GetDefaultConfigFilePath

func GetDefaultConfigFilePath() string

func GetDefaultDatabaseFilePath

func GetDefaultDatabaseFilePath() string

func GetDefaultUserRoles

func GetDefaultUserRoles() []string

GetDefaultUserRoles returns the default roles assigned to a new user when created via registration.

func GetDraftTimeLimit

func GetDraftTimeLimit() int

func GetEditUpdateLimit

func GetEditUpdateLimit() int

func GetEmailCooldown

func GetEmailCooldown() time.Duration

GetEmailCooldown returns the duration before a second activation email may be generated.

func GetEmailFrom

func GetEmailFrom() string

func GetEmailHost

func GetEmailHost() string

func GetEmailPassword

func GetEmailPassword() string

func GetEmailPort

func GetEmailPort() int

func GetEmailUser

func GetEmailUser() string

func GetFaviconPath

func GetFaviconPath() (*string, error)

func GetGuidelinesURL

func GetGuidelinesURL() string

func GetHTTPUpgrade

func GetHTTPUpgrade() bool

func GetHost

func GetHost() string

func GetHostURL

func GetHostURL() string

func GetImageJpegQuality

func GetImageJpegQuality() int

func GetImageLocation

func GetImageLocation() string

GetImageLocation returns the path of where to locally store images.

func GetImageMaxSize

func GetImageMaxSize() *int

func GetIsProduction

func GetIsProduction() bool

func GetJWTSignKey

func GetJWTSignKey() []byte

func GetLogFile

func GetLogFile() string

GetLogFile returns the filename of the file to output logs to. An empty string means that file logging will be disabled.

func GetLogLevel

func GetLogLevel() string

GetLogLevel returns the lowest log level to write to the log. Should be one of "Debug", "Info", "Warning", "Error"

func GetLogOut

func GetLogOut() bool

GetLogOut returns true if logging should be output to the terminal in addition to writing to a log file. Logging will be output to the terminal if file logging is disabled. Defaults to true.

func GetMaxIdleConns

func GetMaxIdleConns() int

func GetMaxOpenConns

func GetMaxOpenConns() int

func GetMinDestructiveVotingPeriod

func GetMinDestructiveVotingPeriod() int

func GetMissingEmailSettings

func GetMissingEmailSettings() []string

func GetPHashDistance

func GetPHashDistance() int

func GetPort

func GetPort() int

func GetProfilerPort

func GetProfilerPort() *int

func GetRequireActivation

func GetRequireActivation() bool

GetRequireActivation returns true if new users must validate their email address via activation to create an account.

func GetRequireInvite

func GetRequireInvite() bool

GetRequireInvite returns true if new users cannot register without an invite key.

func GetRequireSceneDraft

func GetRequireSceneDraft() bool

func GetRequireTagRole

func GetRequireTagRole() bool

func GetSSLCert

func GetSSLCert() string

func GetSSLKey

func GetSSLKey() string

func GetSessionStoreKey

func GetSessionStoreKey() []byte

func GetTitle

func GetTitle() string

func GetUserLogFile

func GetUserLogFile() string

GetUserLogFile returns the filename of the file to output user operation logs to. An empty string means that user operation logging will be output to stderr.

func GetVoteApplicationThreshold

func GetVoteApplicationThreshold() int

func GetVoteCronInterval

func GetVoteCronInterval() string

func GetVotePromotionThreshold

func GetVotePromotionThreshold() *int

func GetVotingPeriod

func GetVotingPeriod() int

func Initialize

func Initialize() error

Unmarshal config

func InitializeDefaults

func InitializeDefaults() error

func ValidateImageLocation

func ValidateImageLocation() error

ValidateImageLocation returns an error is image_location is not set.

Types

type ImageBackendType

type ImageBackendType string
const (
	FileBackend ImageBackendType = "file"
	S3Backend   ImageBackendType = "s3"
)

func GetImageBackend

func GetImageBackend() ImageBackendType

GetImageBackend returns the backend used to store images.

type ImageResizeConfig

type ImageResizeConfig struct {
	Enabled   bool   `mapstructure:"enabled"`
	CachePath string `mapstructure:"cache_path"`
	MinSize   int    `mapstructure:"min_size"`
}

func GetImageResizeConfig

func GetImageResizeConfig() *ImageResizeConfig

type OTelConfig

type OTelConfig struct {
	Endpoint   string  `mapstructure:"endpoint"`
	TraceRatio float64 `mapstructure:"trace_ratio"`
}

func GetOTelConfig

func GetOTelConfig() *OTelConfig

type PostgresConfig

type PostgresConfig struct {
	MaxOpenConns    int `mapstructure:"max_open_conns"`
	MaxIdleConns    int `mapstructure:"max_idle_conns"`
	ConnMaxLifetime int `mapstructure:"conn_max_lifetime"`
}

type S3Config

type S3Config struct {
	Endpoint      string            `mapstructure:"endpoint"`
	Bucket        string            `mapstructure:"bucket"`
	AccessKey     string            `mapstructure:"access_key"`
	Secret        string            `mapstructure:"secret"`
	MaxDimension  int               `mapstructure:"max_dimension"`
	UploadHeaders map[string]string `mapstructure:"upload_headers"`
}

func GetS3Config

func GetS3Config() *S3Config

Jump to

Keyboard shortcuts

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