s3-share/internal/s3Share.go
2022-05-12 23:37:59 +02:00

31 lines
776 B
Go

package s3share
import (
"git.kapelle.org/niklas/s3share/internal/client"
"git.kapelle.org/niklas/s3share/internal/db"
"git.kapelle.org/niklas/s3share/internal/s3"
"git.kapelle.org/niklas/s3share/internal/types"
"git.kapelle.org/niklas/s3share/internal/web"
"github.com/sirupsen/logrus"
)
func Start(config *types.AppConfig) {
db, err := db.NewSqlLiteDB("foo.db")
if err != nil {
logrus.Fatal(err.Error())
}
s3Client, err := s3.NewMinio(config.S3Endpoint, config.S3Bucket, config.S3AccessKey, config.S3SecretKey, config.S3SSL)
if err != nil {
logrus.Fatal(err.Error())
}
client := client.NewClient(db, s3Client)
err = web.StartWebserver(config.Address, *client, config.APIUsername, config.APIPassword)
if err != nil {
logrus.Fatal(err.Error())
}
}