s3staticsite/main.go
2024-02-18 14:30:11 -08:00

25 lines
544 B
Go

package main
import (
"os"
minio "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
"golang.org/x/exp/slog"
)
func main() {
minioClient, err := minio.New(config.S3Endpoint, &minio.Options{
Creds: credentials.NewStaticV4(config.AccessKeyID, config.SecretAccessKey, ""),
Secure: true,
})
if err != nil {
slog.Error("error connecting to s3 server", "error", err)
os.Exit(1)
}
if err := ListenAndServe(minioClient); err != nil {
slog.Error("error starting server", "error", err)
os.Exit(1)
}
}