s3-share/internal/s3Share.go

31 lines
776 B
Go
Raw Normal View History

2022-05-09 12:52:18 +00:00
package s3share
import (
"git.kapelle.org/niklas/s3share/internal/client"
"git.kapelle.org/niklas/s3share/internal/db"
"git.kapelle.org/niklas/s3share/internal/s3"
2022-05-09 14:10:05 +00:00
"git.kapelle.org/niklas/s3share/internal/types"
2022-05-09 12:52:18 +00:00
"git.kapelle.org/niklas/s3share/internal/web"
2022-05-10 10:48:54 +00:00
"github.com/sirupsen/logrus"
2022-05-09 12:52:18 +00:00
)
2022-05-09 14:10:05 +00:00
func Start(config *types.AppConfig) {
2022-05-09 12:52:18 +00:00
db, err := db.NewSqlLiteDB("foo.db")
if err != nil {
2022-05-10 10:48:54 +00:00
logrus.Fatal(err.Error())
2022-05-09 12:52:18 +00:00
}
2022-05-09 14:10:05 +00:00
s3Client, err := s3.NewMinio(config.S3Endpoint, config.S3Bucket, config.S3AccessKey, config.S3SecretKey, config.S3SSL)
2022-05-09 12:52:18 +00:00
if err != nil {
2022-05-10 10:48:54 +00:00
logrus.Fatal(err.Error())
2022-05-09 12:52:18 +00:00
}
client := client.NewClient(db, s3Client)
2022-05-12 21:37:59 +00:00
err = web.StartWebserver(config.Address, *client, config.APIUsername, config.APIPassword)
2022-05-09 12:52:18 +00:00
if err != nil {
2022-05-10 10:48:54 +00:00
logrus.Fatal(err.Error())
2022-05-09 12:52:18 +00:00
}
}