Update with changes from github.com/restic/restic tree

Uncompilable right now, due to bad import paths.
This commit is contained in:
Zlatko Čalušić 2016-11-05 17:18:42 +01:00
parent 07fae00e7d
commit 80196e6df6
5 changed files with 122 additions and 31 deletions

View file

@ -1,3 +1,5 @@
// +build go1.4
package main
import (
@ -9,8 +11,8 @@ import (
)
const (
HTTP = ":8000"
HTTPS = ":8443"
defaultHTTPPort = ":8000"
defaultHTTPSPort = ":8443"
)
func main() {
@ -26,9 +28,10 @@ func main() {
"index",
"locks",
"keys",
"tmp",
}
for _, d := range dirs {
os.MkdirAll(filepath.Join(*path, d), 0600)
os.MkdirAll(filepath.Join(*path, d), 0700)
}
// Define the routes
@ -56,15 +59,15 @@ func main() {
// start the server
if !*tls {
log.Printf("start server on port %s\n", HTTP)
http.ListenAndServe(HTTP, handler)
log.Printf("start server on port %s\n", defaultHTTPPort)
http.ListenAndServe(defaultHTTPPort, handler)
} else {
privateKey := filepath.Join(*path, "private_key")
publicKey := filepath.Join(*path, "public_key")
log.Println("TLS enabled")
log.Printf("private key: %s", privateKey)
log.Printf("public key: %s", publicKey)
log.Printf("start server on port %s\n", HTTPS)
http.ListenAndServeTLS(HTTPS, publicKey, privateKey, handler)
log.Printf("start server on port %s\n", defaultHTTPSPort)
http.ListenAndServeTLS(defaultHTTPSPort, publicKey, privateKey, handler)
}
}