config

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 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,
}
View Source
var Database = "database"
View Source
var JWTSignKey = "jwt_secret_key"
View Source
var SessionStoreKey = "session_store_key"

Functions

func GetActivationExpireTime

func GetActivationExpireTime() time.Time

GetActivationExpireTime returns the time at which activation emails expire, using the current time as the basis.

func GetActivationExpiry

func GetActivationExpiry() time.Duration

GetActivationExpiry returns the duration before an activation email expires.

func GetConnMaxLifetime added in v0.1.7

func GetConnMaxLifetime() int

func GetDatabasePath

func GetDatabasePath() string

func GetDefaultUserRoles

func GetDefaultUserRoles() []string

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

func GetDraftTimeLimit added in v0.1.0

func GetDraftTimeLimit() 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 added in v0.1.0

func GetFaviconPath() (*string, error)

func GetGuidelinesURL added in v0.5.1

func GetGuidelinesURL() string

func GetHTTPUpgrade

func GetHTTPUpgrade() bool

func GetHost

func GetHost() string

func GetHostURL

func GetHostURL() string

func GetImageLocation

func GetImageLocation() string

GetImageLocation returns the path of where to locally store images.

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 added in v0.1.7

func GetMaxIdleConns() int

func GetMaxOpenConns added in v0.1.7

func GetMaxOpenConns() int

func GetMinDestructiveVotingPeriod added in v0.1.0

func GetMinDestructiveVotingPeriod() int

func GetMissingEmailSettings

func GetMissingEmailSettings() []string

func GetPHashDistance

func GetPHashDistance() int

func GetPort

func GetPort() int

func GetProfilerPort added in v0.1.6

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 GetSessionStoreKey

func GetSessionStoreKey() []byte

func GetTitle added in v0.1.0

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 added in v0.1.0

func GetVoteApplicationThreshold() int

func GetVoteCronInterval added in v0.1.0

func GetVoteCronInterval() string

func GetVotePromotionThreshold added in v0.1.0

func GetVotePromotionThreshold() *int

func GetVotingPeriod added in v0.1.0

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 PostgresConfig added in v0.1.7

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 {
	BaseURL       string            `mapstructure:"base_url"`
	Endpoint      string            `mapstructure:"endpoint"`
	Bucket        string            `mapstructure:"bucket"`
	AccessKey     string            `mapstructure:"access_key"`
	Secret        string            `mapstructure:"secret"`
	MaxDimension  int64             `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