summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/main.go b/main.go
index 56445a9..3c8b1a5 100644
--- a/main.go
+++ b/main.go
@@ -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 != "" {