blob: d913dcf088433e3e1c9a1c860c50e8972345b7b6 (
plain) (
blame)
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
|
package main
import (
"skunkyart/app"
"skunkyart/static"
"time"
"github.com/krazywarez/devianter"
)
// version is the release this binary was built from. The release workflow links
// it in from the git tag so that --help and /api/instance cannot drift from the
// tag the image was built at:
//
// go build -ldflags "-X main.version=1.3.7"
//
// A plain `go build` leaves it as "dev".
var version = "dev"
func main() {
app.Release.Version = version
app.Release.Description = "Two API endpoints and template embedding into binary"
app.ExecuteCommandLineArguments()
app.ExecuteConfig()
static.CopyTemplatesToMemory()
// Rate/concurrency-limit + time-out outbound DeviantArt requests so bot floods
// can't exhaust the process or get our egress IP banned by CloudFront/WAF.
app.InstallDAThrottle()
// Only once the config is loaded and the throttle installed: this fetches over
// the network, so starting it earlier both raced ExecuteConfig's writes to CFG
// and let the request escape the throttle and the configured User-Agent.
go app.RefreshInstances()
go func() {
for {
err := devianter.UpdateCSRF()
if err != nil {
println(err.Error())
}
time.Sleep(12 * time.Hour)
}
}()
app.Router()
}
|