2021-08-19 20:12:12 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2021-08-20 15:28:10 +00:00
|
|
|
log.Println("=== Starting Bagage ===")
|
2021-08-23 18:40:03 +00:00
|
|
|
config := (&Config{}).LoadWithDefault().LoadWithEnv()
|
|
|
|
|
|
|
|
log.Println(config)
|
|
|
|
|
|
|
|
// Assemble components to handle WebDAV requests
|
|
|
|
http.Handle(config.DavPath+"/",
|
|
|
|
BasicAuthExtract{
|
|
|
|
OnNotFound: NotAuthorized{},
|
|
|
|
OnCreds: LdapPreAuth{
|
|
|
|
WithConfig: config,
|
|
|
|
OnWrongPassword: NotAuthorized{},
|
|
|
|
OnFailure: InternalError{},
|
|
|
|
OnCreds: S3Auth{
|
|
|
|
WithConfig: config,
|
|
|
|
OnFailure: InternalError{},
|
|
|
|
OnMinioClient: WebDav{
|
|
|
|
WithConfig: config,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-08-19 20:14:53 +00:00
|
|
|
})
|
2021-08-19 20:12:12 +00:00
|
|
|
|
2021-08-23 18:40:03 +00:00
|
|
|
if err := http.ListenAndServe(config.HttpListen, nil); err != nil {
|
2021-08-19 20:12:12 +00:00
|
|
|
log.Fatalf("Error with WebDAV server: %v", err)
|
|
|
|
}
|
|
|
|
}
|