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"` APIUsername string `arg:"--api-username,required,env:API_USERNAME" help:"username for API" placeholder:"USERNAME"` APIPassword string `arg:"--api-password,required,env:API_PASSWORD" help:"password for API" placeholder:"PASSWORD"` DBConnection string `arg:"--db,required,env:DB_CONNECTION" help:"DSN in format: https://github.com/go-sql-driver/mysql#dsn-data-source-name"` } func (args) Version() string { return "s3share 1.0" } func main() { var args args arg.MustParse(&args) s3share.Start(&types.AppConfig{ S3Endpoint: args.S3Endpoint, S3AccessKey: args.S3AccessKey, S3SecretKey: args.S3SecretKey, S3SSL: !args.S3DisableSSL, S3Bucket: args.S3Bucket, Address: args.Address, APIUsername: args.APIUsername, APIPassword: args.APIPassword, DSN: args.DBConnection, }) }