config

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 1 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Settings = &Config{
	General: General{
		GuestPosting:     true,
		AutoRegistration: true,
	},
	Prim: Prim{
		CSS: "prim.css",
		JS:  "prim.js",
	},
	CloudFlare: CloudFlare{},
	Akismet:    Akismet{},
	StopForumSpam: StopForumSpam{
		Confidence: 40,
	},
	Amazon: Amazon{},
	Limits: Limits{
		ImageMinWidth:      100,
		ImageMinHeight:     100,
		ImageMaxWidth:      20000,
		ImageMaxHeight:     20000,
		ImageMaxSize:       20000000,
		AvatarMinWidth:     100,
		AvatarMinHeight:    100,
		AvatarMaxWidth:     1000,
		AvatarMaxHeight:    1000,
		AvatarMaxSize:      1000000,
		WebmMaxLength:      300,
		PostsMax:           800,
		CommentMaxLength:   1000,
		CommentMinLength:   3,
		TitleMaxLength:     40,
		TitleMinLength:     3,
		NameMaxLength:      20,
		NameMinLength:      3,
		TagMaxLength:       128,
		TagMinLength:       3,
		PasswordMaxLength:  128,
		PasswordMinLength:  8,
		ThumbnailMaxWidth:  200,
		ThumbnailMaxHeight: 300,
		PostsPerPage:       40,
		ThreadsPerPage:     10,
		PostsPerThread:     5,
		ParamMaxSize:       1000000,
	},
}

Settings holds an initialized settings with some sane defaults

Functions

func GetDatabaseSettings

func GetDatabaseSettings()

GetDatabaseSettings gets limits that are in the database

Types

type Akismet added in v1.3.0

type Akismet struct {
	Configured bool
	Key        string
	Host       string
}

Akismet settings

type Amazon added in v1.3.0

type Amazon struct {
	Configured bool
	Region     string
	Bucket     string
	ID         string
	Key        string
}

Amazon holds API settings for Amazon

type CloudFlare added in v1.3.0

type CloudFlare struct {
	Configured bool
	Key        string
	Email      string
}

CloudFlare API settings

type Config

type Config struct {
	General       General
	Prim          Prim
	CloudFlare    CloudFlare
	Akismet       Akismet
	StopForumSpam StopForumSpam
	Scamalytics   Scamalytics
	Amazon        Amazon
	Limits        Limits
}

Config holds the main configuration data

type General added in v1.3.0

type General struct {
	GuestPosting     bool
	AutoRegistration bool
}

General options

type Limits added in v1.3.0

type Limits struct {
	// Image settings
	ImageMinWidth  int
	ImageMinHeight int
	ImageMaxWidth  int
	ImageMaxHeight int
	ImageMaxSize   int

	// avatar settings
	AvatarMinWidth  int
	AvatarMinHeight int
	AvatarMaxWidth  int
	AvatarMaxHeight int
	AvatarMaxSize   int

	// webm settings
	WebmMaxLength int

	// Max posts in a thread
	PostsMax uint

	// Lengths for posting
	CommentMaxLength int
	CommentMinLength int

	TitleMaxLength int
	TitleMinLength int

	NameMaxLength int
	NameMinLength int

	TagMaxLength int
	TagMinLength int

	PasswordMaxLength int
	PasswordMinLength int

	// Max thumbnail sizes
	ThumbnailMaxWidth  int
	ThumbnailMaxHeight int

	// Set default posts per page
	PostsPerPage uint
	// Set default threads per index page
	ThreadsPerPage uint
	// Add one to number because first post is included
	PostsPerThread uint

	// Max request parameter input size
	ParamMaxSize uint
}

Limits for various items

type Prim added in v1.3.0

type Prim struct {
	CSS string
	JS  string
}

Prim holds asset names for Prim

type Scamalytics added in v1.7.9

type Scamalytics struct {
	Configured bool
	Key        string
	Endpoint   string
	Path       string
	Score      int
}

Scamalytics settings

type StopForumSpam added in v1.3.0

type StopForumSpam struct {
	Confidence float64
}

StopForumSpam settings

Jump to

Keyboard shortcuts

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