fixed typo
This commit is contained in:
parent
4c4ef95ee7
commit
2b25003344
2
.env
2
.env
@ -2,7 +2,7 @@
|
|||||||
S3_ENDPOINT=localhost:9000
|
S3_ENDPOINT=localhost:9000
|
||||||
S3_ACCESS_KEY=testo
|
S3_ACCESS_KEY=testo
|
||||||
S3_SECRET_KEY=testotesto
|
S3_SECRET_KEY=testotesto
|
||||||
S3_BUKET=dev
|
S3_BUCKET=dev
|
||||||
S3_DISABLE_SSL=true
|
S3_DISABLE_SSL=true
|
||||||
ADDRESS=:8080
|
ADDRESS=:8080
|
||||||
VERBOSE=true
|
VERBOSE=true
|
@ -11,7 +11,7 @@ type args struct {
|
|||||||
S3Endpoint string `arg:"--s3-endpoint,required,env:S3_ENDPOINT" help:"host[:port]" placeholder:"ENDPOINT"`
|
S3Endpoint string `arg:"--s3-endpoint,required,env:S3_ENDPOINT" help:"host[:port]" placeholder:"ENDPOINT"`
|
||||||
S3AccessKey string `arg:"--s3-access-key,required,env:S3_ACCESS_KEY" placeholder:"ACCESS_KEY"`
|
S3AccessKey string `arg:"--s3-access-key,required,env:S3_ACCESS_KEY" placeholder:"ACCESS_KEY"`
|
||||||
S3SecretKey string `arg:"--s3-secret-key,required,env:S3_SECRET_KEY" placeholder:"SECRET_KEY"`
|
S3SecretKey string `arg:"--s3-secret-key,required,env:S3_SECRET_KEY" placeholder:"SECRET_KEY"`
|
||||||
S3Buket string `arg:"--s3-buket,required,env:S3_BUKET" placeholder:"BUKET"`
|
S3Bucket string `arg:"--s3-bucket,required,env:S3_BUCKET" placeholder:"BUCKET"`
|
||||||
S3DisableSSL bool `arg:"--s3-disable-ssl,env:S3_DISABLE_SSL" default:"false"`
|
S3DisableSSL bool `arg:"--s3-disable-ssl,env:S3_DISABLE_SSL" default:"false"`
|
||||||
Address string `arg:"--address,env:ADDRESS" default:":3000" help:"what address to listen on" placeholder:"ADDRESS"`
|
Address string `arg:"--address,env:ADDRESS" default:":3000" help:"what address to listen on" placeholder:"ADDRESS"`
|
||||||
CacheTTL int64 `arg:"--cache-ttl,env:CACHE_TTL" help:"Time in seconds" default:"30" placeholder:"TTL"`
|
CacheTTL int64 `arg:"--cache-ttl,env:CACHE_TTL" help:"Time in seconds" default:"30" placeholder:"TTL"`
|
||||||
@ -33,7 +33,7 @@ func main() {
|
|||||||
S3SSL: !args.S3DisableSSL,
|
S3SSL: !args.S3DisableSSL,
|
||||||
S3AccessKey: args.S3AccessKey,
|
S3AccessKey: args.S3AccessKey,
|
||||||
S3SecretKey: args.S3SecretKey,
|
S3SecretKey: args.S3SecretKey,
|
||||||
S3Buket: args.S3Buket,
|
S3Bucket: args.S3Bucket,
|
||||||
CacheTTL: time.Duration(args.CacheTTL) * time.Second,
|
CacheTTL: time.Duration(args.CacheTTL) * time.Second,
|
||||||
CacheCleanup: time.Duration(args.CacheCleanup) * time.Second,
|
CacheCleanup: time.Duration(args.CacheCleanup) * time.Second,
|
||||||
Address: args.Address,
|
Address: args.Address,
|
||||||
|
@ -16,7 +16,7 @@ type AppConfig struct {
|
|||||||
S3AccessKey string
|
S3AccessKey string
|
||||||
S3SecretKey string
|
S3SecretKey string
|
||||||
S3SSL bool
|
S3SSL bool
|
||||||
S3Buket string
|
S3Bucket string
|
||||||
CacheTTL time.Duration
|
CacheTTL time.Duration
|
||||||
CacheCleanup time.Duration
|
CacheCleanup time.Duration
|
||||||
Address string
|
Address string
|
||||||
@ -54,14 +54,14 @@ func setupS3Client(config AppConfig) (*minio.Client, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
exists, err := minioClient.BucketExists(context.Background(), config.S3Buket)
|
exists, err := minioClient.BucketExists(context.Background(), config.S3Bucket)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !exists {
|
if !exists {
|
||||||
return nil, fmt.Errorf("Bucket '%s' does not exist", config.S3Buket)
|
return nil, fmt.Errorf("Bucket '%s' does not exist", config.S3Bucket)
|
||||||
}
|
}
|
||||||
|
|
||||||
return minioClient, nil
|
return minioClient, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user