@ -30,6 +30,8 @@ services:
- LENMONITOR_ADDRESS=:80 # ADDRES:PORT for HTTP server.
- LENMONITOR_DB_DRIVER=sqlite3 # Currently supported drivers: 'sqlite3' and 'postgres'.
- LENMONITOR_DB_SOURCE=/data/lenmonitor.db # DB source.
- LENPASTE_DB_MAX_OPEN_CONNS=25 # Maximum number of connections to the database.
- LENPASTE_DB_MAX_IDLE_CONNS=5 # Maximum number of idle connections to the database.
- LENMONITOR_ROBOTS_DISALLOW=false # Prohibits search engine crawlers from indexing site using robots.txt file.
- LENMONITOR_ADD_SERVERS_PER_5MIN=10 # Maximum number of servers that can be added in 5 minutes from one IP. If 0 disable rate-limit.
- LENMONITOR_ADMIN_NAME= # Name of the administrator of this server.
@ -29,7 +29,7 @@ type Data struct {
Log logger.Logger
DB storage.DB
AddRateLimit netshare.RateLimit
AddRateLimit *netshare.RateLimit
Version *string
@ -26,7 +26,7 @@ import (
type Config struct {
Version string
@ -28,7 +28,7 @@ import (
var AvalibleSrv = []string{"lenpaste"}
func AddServer(req *http.Request, db storage.DB, rateLimit RateLimit) (string, string, error) {
func AddServer(req *http.Request, db storage.DB, rateLimit *RateLimit) (string, string, error) {
// Check HTTP method
if req.Method != "POST" {
return "", "", ErrMethodNotAllowed
@ -43,8 +43,8 @@ type RateLimit struct {
List RateLimitList
}
func NewRateLimit(reqPer5Minute int) RateLimit {
return RateLimit{
func NewRateLimit(reqPer5Minute int) *RateLimit {
return &RateLimit{
ReqPer5Minute: reqPer5Minute,
List: RateLimitList{
m: make(map[string]RateLimitIP),
@ -34,7 +34,7 @@ type Data struct {
Locales *Locales
LocaleSelector *map[string]string