s3-share/cmd/s3share.go

36 lines
1.1 KiB
Go
Raw Normal View History

2022-05-09 12:52:18 +00:00
package main
2022-05-09 14:10:05 +00:00
import (
s3share "git.kapelle.org/niklas/s3share/internal"
"git.kapelle.org/niklas/s3share/internal/types"
"github.com/alexflint/go-arg"
)
type args struct {
S3Endpoint string `arg:"--s3-endpoint,required,env:S3_ENDPOINT" help:"host[:port]" placeholder:"ENDPOINT"`
S3Bucket string `arg:"--s3-bucket,required,env:S3_BUCKET" help:"bucket to use" placeholder:"BUCKET"`
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"`
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"`
}
func (args) Version() string {
// TODO
return "s3share 0.1"
}
2022-05-09 12:52:18 +00:00
func main() {
2022-05-09 14:10:05 +00:00
var args args
arg.MustParse(&args)
s3share.Start(&types.AppConfig{
S3Endpoint: args.S3Endpoint,
S3AccessKey: args.S3AccessKey,
S3SecretKey: args.S3SecretKey,
S3SSL: !args.S3DisableSSL,
2022-05-10 10:48:36 +00:00
S3Bucket: args.S3Bucket,
2022-05-09 14:10:05 +00:00
Address: args.Address,
})
2022-05-09 12:52:18 +00:00
}