-
Notifications
You must be signed in to change notification settings - Fork 13
/
main.go
50 lines (41 loc) · 1006 Bytes
/
main.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
package main
import (
"flag"
"fmt"
"log"
"net/http"
"strconv"
)
type Site struct {
Host string `json:"host"`
AWSKey string `json:"awsKey"`
AWSSecret string `json:"awsSecret"`
AWSRegion string `json:"awsRegion"`
AWSBucket string `json:"awsBucket"`
Users []User `json:"users"`
Options Options `json:"options"`
}
type User struct {
Name string `json:"name"`
Password string `json:"password"`
}
type Options struct {
CORS bool `json:"cors"`
Gzip bool `json:"gzip"`
Website bool `json:"website"`
Prefix string `json:"prefix"`
ForceSSL bool `json:"forceSsl"`
Proxied bool `json:"proxied"`
}
func main() {
handler, err := ConfiguredProxyHandler()
if err != nil {
fmt.Printf("fatal: %v\n", err)
return
}
port := flag.Int("port", 8080, "Port to listen on")
flag.Parse()
portStr := strconv.FormatInt(int64(*port), 10)
log.Println("s3-proxy is listening on port " + portStr)
log.Fatal(http.ListenAndServe(":"+portStr, handler))
}