-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.go
31 lines (25 loc) · 1.22 KB
/
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
package main
import (
"flag"
"log"
"github.com/mjneil/go-chunked-streaming-server/server"
)
var (
certFilePath = flag.String("c", "", "Certificate file path (only for https)")
keyFilePath = flag.String("k", "", "Key file path (only for https)")
baseOutPath = flag.String("p", "./content", "Path used to store")
port = flag.Int("i", 9094, "Port used for HTTP ingress/ egress")
corsConfigFilePath = flag.String("o", "", "JSON file path with the CORS headers definition")
onlyRAM = flag.Bool("r", false, "Indicates DO NOT use disc as persistent/fallback storage (only RAM)")
waitForDataToArrive = flag.Bool("w", false, "Indicates to GET request to wait for some specific if data is NOT present yet")
doCleanupBasedOnCacheHeaders = flag.Bool("d", false, "Indicates to remove files from the server based on original Cache-Control (max-age) header")
)
func checkError(err error) {
if err != nil {
log.Fatalln(err)
}
}
func main() {
flag.Parse()
checkError(server.StartHTTPServer(*baseOutPath, *port, *certFilePath, *keyFilePath, *corsConfigFilePath, *onlyRAM, *doCleanupBasedOnCacheHeaders, *waitForDataToArrive))
}