cli: Remove unneeded flag validation check
Closes https://github.com/tus/tusd/issues/229
This commit is contained in:
parent
3c4cadd37c
commit
d2be5e82bd
|
@ -54,7 +54,7 @@ snippet demonstrates how to start a tusd process which accepts tus uploads at
|
|||
`http://localhost:1080/files/` (notice the trailing slash) and stores them locally in the `./data` directory:
|
||||
|
||||
```
|
||||
$ tusd -dir=./data
|
||||
$ tusd -upload-dir./data
|
||||
[tusd] Using './data' as directory storage.
|
||||
[tusd] Using 0.00MB as maximum size.
|
||||
[tusd] Using 0.0.0.0:1080 as address to listen.
|
||||
|
|
|
@ -3,6 +3,7 @@ package cli
|
|||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/tus/tusd/pkg/filelocker"
|
||||
"github.com/tus/tusd/pkg/filestore"
|
||||
|
@ -42,6 +43,11 @@ func CreateComposer() {
|
|||
locker := memorylocker.New()
|
||||
locker.UseIn(Composer)
|
||||
} else if Flags.GCSBucket != "" {
|
||||
if Flags.GCSObjectPrefix != "" && strings.Contains(Flags.GCSObjectPrefix, "_") {
|
||||
stderr.Fatalf("gcs-object-prefix value (%s) can't contain underscore. "+
|
||||
"Please remove underscore from the value", Flags.GCSObjectPrefix)
|
||||
}
|
||||
|
||||
// Derivce credentials from service account file path passed in
|
||||
// GCS_SERVICE_ACCOUNT_FILE environment variable.
|
||||
gcsSAF := os.Getenv("GCS_SERVICE_ACCOUNT_FILE")
|
||||
|
|
|
@ -44,7 +44,7 @@ func ParseFlags() {
|
|||
flag.StringVar(&Flags.HttpPort, "port", "1080", "Port to bind HTTP server to")
|
||||
flag.StringVar(&Flags.HttpSock, "unix-sock", "", "If set, will listen to a UNIX socket at this location instead of a TCP socket")
|
||||
flag.Int64Var(&Flags.MaxSize, "max-size", 0, "Maximum size of a single upload in bytes")
|
||||
flag.StringVar(&Flags.UploadDir, "dir", "./data", "Directory to store uploads in")
|
||||
flag.StringVar(&Flags.UploadDir, "upload-dir", "./data", "Directory to store uploads in")
|
||||
flag.StringVar(&Flags.Basepath, "base-path", "/files/", "Basepath of the HTTP server")
|
||||
flag.Int64Var(&Flags.Timeout, "timeout", 30*1000, "Read timeout for connections in milliseconds. A zero value means that reads will not timeout")
|
||||
flag.StringVar(&Flags.S3Bucket, "s3-bucket", "", "Use AWS S3 with this bucket as storage backend (requires the AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_REGION environment variables to be set)")
|
||||
|
@ -80,18 +80,6 @@ func ParseFlags() {
|
|||
|
||||
stdout.Printf("Using '%s' as the endpoint for hooks", Flags.HttpHooksEndpoint)
|
||||
}
|
||||
|
||||
if Flags.UploadDir == "" && Flags.S3Bucket == "" {
|
||||
stderr.Fatalf("Either an upload directory (using -dir) or an AWS S3 Bucket " +
|
||||
"(using -s3-bucket) must be specified to start tusd but " +
|
||||
"neither flag was provided. Please consult `tusd -help` for " +
|
||||
"more information on these options.")
|
||||
}
|
||||
|
||||
if Flags.GCSObjectPrefix != "" && strings.Contains(Flags.GCSObjectPrefix, "_") {
|
||||
stderr.Fatalf("gcs-object-prefix value (%s) can't contain underscore. "+
|
||||
"Please remove underscore from the value", Flags.GCSObjectPrefix)
|
||||
}
|
||||
}
|
||||
|
||||
func SetEnabledHooks() {
|
||||
|
|
Loading…
Reference in New Issue