added configuration
This commit is contained in:
@@ -4,16 +4,17 @@ 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"
|
||||
)
|
||||
|
||||
func Start() {
|
||||
func Start(config *types.AppConfig) {
|
||||
db, err := db.NewSqlLiteDB("foo.db")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
s3Client, err := s3.NewMinio("localhost:9000", "testo", "testo", "hunter22", false)
|
||||
s3Client, err := s3.NewMinio(config.S3Endpoint, config.S3Bucket, config.S3AccessKey, config.S3SecretKey, config.S3SSL)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -21,13 +22,7 @@ func Start() {
|
||||
|
||||
client := client.NewClient(db, s3Client)
|
||||
|
||||
// share, err := client.CreateShare(context.Background(), "/go.mod")
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// logrus.Info(share.Slug)
|
||||
|
||||
err = web.StartWebserver("localhost:8080", *client)
|
||||
err = web.StartWebserver(config.Address, *client)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -4,3 +4,12 @@ type Share struct {
|
||||
Slug string `json:"slug"`
|
||||
Key string `json:"key"`
|
||||
}
|
||||
|
||||
type AppConfig struct {
|
||||
S3Endpoint string
|
||||
S3AccessKey string
|
||||
S3SecretKey string
|
||||
S3SSL bool
|
||||
S3Bucket string
|
||||
Address string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user