-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
163 lines (142 loc) · 3.01 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
package config
// Settings holds an initialized settings with some sane defaults
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,
},
}
// Config holds the main configuration data
type Config struct {
General General
Prim Prim
CloudFlare CloudFlare
Akismet Akismet
StopForumSpam StopForumSpam
Scamalytics Scamalytics
Amazon Amazon
Limits Limits
}
// General options
type General struct {
GuestPosting bool
AutoRegistration bool
}
// Prim holds asset names for Prim
type Prim struct {
CSS string
JS string
}
// CloudFlare API settings
type CloudFlare struct {
Configured bool
Key string
Email string
}
// Akismet settings
type Akismet struct {
Configured bool
Key string
Host string
}
// StopForumSpam settings
type StopForumSpam struct {
Confidence float64
}
// Scamalytics settings
type Scamalytics struct {
Configured bool
Key string
Endpoint string
Path string
Score int
}
// Amazon holds API settings for Amazon
type Amazon struct {
Configured bool
Region string
Bucket string
ID string
Key string
}
// Limits for various items
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
}