s3-share/cmd/s3share.go
2022-05-09 16:10:05 +02:00

35 lines
1.1 KiB
Go

package main
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"
}
func main() {
var args args
arg.MustParse(&args)
s3share.Start(&types.AppConfig{
S3Endpoint: args.S3Endpoint,
S3AccessKey: args.S3AccessKey,
S3SecretKey: args.S3SecretKey,
S3SSL: !args.S3DisableSSL,
Address: args.Address,
})
}