diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -11,6 +11,7 @@ import ( "path" "path/filepath" "flag" + "bufio" "github.com/google/uuid" ) @@ -114,13 +115,22 @@ func (handler BoxHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { func main() { host := flag.String("n", "", "The hostname to listen on") port := flag.Int("p", 8080, "The port to listen on") - token := flag.String("t", "", "The token to use to protect uploads") + isToken := flag.Bool("t", false, "Use a token to protect uploads/deletes") filesPath := flag.String("d", "", "The path to the files") deleteEnabled := flag.Bool("D", false, "Enable deleting resources") flag.Parse() + + token := "" + if *isToken { + fmt.Print("Token: ") + sc := bufio.NewScanner(os.Stdin) + sc.Scan() + token = sc.Text() + } + boxHandler := BoxHandler { *filesPath, - *token, + token, *deleteEnabled, } if boxHandler.filesPath != "" { |
